go-delve/delve · error

not enough arguments to %s

Error message

not enough arguments to %s

What it means

After evaluating all argument expressions for a function call, Delve picks the argument whose truthiness selects the overload/branch. If no argument was selected (best == nil) the call does not have enough arguments, so evaluation of the call fails with this error naming the function.

Source

Thrown at pkg/proc/eval.go:2100

		}

		_, err := negotiateType(op, args[i], best)
		if err != nil {
			return nil, err
		}

		v, err := compareOp(op, args[i], best)
		if err != nil {
			return nil, err
		}

		if v {
			best = args[i]
		}
	}

	if best == nil {
		return nil, fmt.Errorf("not enough arguments to %s", name)
	}
	return best, nil
}

// Evaluates expressions <subexpr>.<field name> where subexpr is not a package name
func (scope *EvalScope) evalStructSelector(op *evalop.Select, stack *evalStack) {
	xv := stack.pop()
	// Prevent abuse, attempting to call "nil.member" directly.
	if xv.Addr == 0 && xv.Name == "nil" {
		stack.err = fmt.Errorf("%s (type %s) is not a struct", xv.Name, xv.TypeString())
		return
	}
	// Prevent abuse, attempting to call "\"fake\".member" directly.
	if xv.Addr == 0 && xv.Name == "" && xv.DwarfType == nil && xv.RealType == nil {
		stack.err = fmt.Errorf("%s (type %s) is not a struct", xv.Value, xv.TypeString())
		return
	}
	// Special type conversions for CPU register variables (REGNAME.int8, etc)

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Supply all required arguments in the call expression, matching the function signature.
  2. Use 'print <fn>' or check the function signature in the source to count required parameters.
  3. For variadic or defaulted-style usage, pass explicit zero values for missing arguments.
  4. If calling a method, ensure the receiver expression is included correctly in the call syntax.

Example fix

// before
dlv> call fmt.Sprintf("%d-%s")
// error: not enough arguments to fmt.Sprintf
// after
dlv> call fmt.Sprintf("%d-%s", 42, "x")
Defensive patterns

Strategy: validation

Validate before calling

// Count required params before calling; in the CLI:
// dlv> print fmt.Sprintf   // inspect signature first
// Or check the source signature matches the number of args supplied.

Try / catch

res, err := scope.EvalExpression(callExpr, cfg)
if err != nil && strings.Contains(err.Error(), "not enough arguments to") {
    // rebuild the call expression with all required arguments
}

Prevention

When it happens

Trigger: Issuing a 'call <name>(...)' expression with fewer arguments than the function requires; also hit when all argument evaluations produced non-selected (false) values in the selection logic preceding the check at eval.go:2100.

Common situations: Typos or omitted arguments when calling methods from the debugger prompt, e.g. 'call fmt.Printf("%d")' without the value, or calling a method with receiver arguments missed.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/dd6beb9dfe3f44bb. Report an issue: GitHub.