not enough / too many arguments in call Go Origin: Application & API Last updated 4 Nov 2026

Go: not enough arguments in call to f have (int) want (int, string)

A function was called with fewer or more arguments than it declares.

Exact message you may see not enough arguments in call totoo many arguments in call tohave (int) want (int, string)not enough arguments to returntoo many return values
Seen on: Go

Meaning

Compare the call with the function signature; the error shows have and want. After changing a function signature, update all call sites. For variadic functions use args... to pass a slice.

Common causes

  • Signature changed but callers not updated
  • Forgot an argument (context.Context, error handling)
  • Extra argument passed
  • Method vs function confusion
  • Variadic slice not expanded

⚡ Quick fix

  1. Match the call to want (…)
  2. Update all callers after changing the signature
  3. Use f(items...) for variadic parameters

Detailed fix by platform

Go

  1. Use gopls rename/change-signature refactoring in your editor to update call sites

How to diagnose

  1. Have/want — Compare lists?
  2. Signature — Recently changed?
  3. Variadic — Expanded?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

assignment mismatch: 1 variable but f returns 2 values — Go: assignment mismatch: 1 variable but os.Open returns 2 values (Go)assignment mismatch: …cannot assign to struct field m[k].f in map — Go: cannot assign to struct field users["bob"].Age in map (Go)cannot assign to stru…cannot use x as type in assignment/argument — Go: cannot use "5" (untyped string constant) as int value in argument to f (Go)cannot use x as type …does not implement interface (missing method) — Go: cannot use &Dog{} (value of type *Dog) as Animal value: *Dog does not implement Animal (missing method Speak) (Go)does not implement in…function main is undeclared in the main package — Go: runtime.main_main·f: function main is undeclared in the main package (Go)function main is unde…import cycle not allowed — Go: package app/models imports app/utils imports app/models: import cycle not allowed (Go)import cycle not allo…undefined: x — Go: ./main.go:12:2: undefined: handler (Go)undefined: xnot enoug…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.