go-delve/delve · error
not enough arguments
Error message
not enough arguments
What it means
Delve throws this when a function call expression provides fewer arguments than the target function requires. Call injection must set up every formal parameter before transferring control; missing arguments leave the argument area incomplete, so Delve rejects the call before injection.
Source
Thrown at pkg/proc/fncall.go:66
// When the target has runtime.debugPinner then evalCallInjectionPinPointer
// must be also called in a loop until it returns false.
const (
debugCallFunctionNamePrefix1 = "debugCall"
debugCallFunctionNamePrefix2 = "runtime.debugCall"
maxDebugCallVersion = 2
maxArgFrameSize = 65535
)
var (
errFuncCallUnsupported = errors.New("function calls not supported by this version of Go")
errFuncCallUnsupportedBackend = errors.New("backend does not support function calls")
errFuncCallInProgress = errors.New("cannot call function while another function call is already in progress")
errNoGoroutine = errors.New("no goroutine selected")
errGoroutineNotRunning = errors.New("selected goroutine not running")
errNotEnoughStack = errors.New("not enough stack space")
errTooManyArguments = errors.New("too many arguments")
errNotEnoughArguments = errors.New("not enough arguments")
errNotAGoFunction = errors.New("not a Go function")
errFuncCallNotAllowedStrAlloc = errors.New("literal string can not be allocated because function calls are not allowed without using 'call'")
)
type functionCallState struct {
// savedRegs contains the saved registers
savedRegs Registers
// err contains a saved error
err error
// expr is the expression being evaluated
expr *ast.CallExpr
// fn is the function that is being called
fn *Function
// receiver is the receiver argument for the function
receiver *Variable
// closureAddr is the address of the closure being called
closureAddr uint64
// formalArgs are the formal arguments of fnView on GitHub (pinned to a23773e6c3)
Solutions
- Supply all required arguments in the call expression
- Check the exact signature via `print <fn>` or editor before calling
- Bind values from the current scope (locals are valid argument expressions)
- If you only need the value, use `print f(args)` after fixing args, or drop the call
Example fix
// before (dlv) call add(1) // after (dlv) call add(1, 2)
Defensive patterns
Strategy: validation
Validate before calling
// count args before calling (dlv) print add // supply every formal argument in the call expression
Try / catch
if err := scope.CallFunction(expr); err != nil && err.Error() == "not enough arguments" {
// complete the argument list and retry
} Prevention
- Supply all required parameters in call expressions
- Verify the current signature (it may have gained params)
- Do not rely on defaults; Go has none
- Account for method receivers when reading arity
When it happens
Trigger: `call f(a)` where f requires 2 parameters; omitting arguments that have no default (Go has no default arguments); calling a method without accounting for the receiver.
Common situations: Porting a call from an older signature that had fewer parameters; forgetting a variadic argument list; hand-writing calls in the dlv REPL against a remembered signature.
Related errors
- too many arguments
- not enough stack space
- not a Go function
- literal string can not be allocated because function calls a
- no return values
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/ac34fbe2f671b8fd.
Report an issue: GitHub.