Skip to content
Latchkey

Go "not enough arguments in call to f" in CI

The compiler counted the arguments at the call and found fewer than the function declares. Go requires every parameter to be supplied, so the call will not compile until it matches.

What this error means

Compilation fails with "not enough arguments in call to f" and prints the expected versus the supplied parameter list.

go build
./handler.go:22:18: not enough arguments in call to NewClient
	have (string)
	want (string, time.Duration)

Common causes

A new parameter was added to the function

The function gained a parameter (a context, a timeout) but a caller still passes the old, shorter argument list.

A variadic was expected to expand but did not

Calling a function that requires fixed parameters with too few values produces this error rather than a runtime panic.

How to fix it

Supply the missing argument

  1. Read the "have" and "want" lines to see which parameter is missing.
  2. Pass the additional argument the signature now requires.
  3. Rebuild to confirm the arity matches.
handler.go
// want (string, time.Duration)
NewClient(addr, 5*time.Second)

Update all callers together

When you add a parameter, update every call site in the same change so none is left short.

How to prevent it

  • Build the whole module in CI so every caller is type-checked.
  • Change a signature and its callers in one commit.
  • Use functional options for optional parameters to avoid arity churn.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →