go-delve/delve · error
too many arguments
Error message
too many arguments
What it means
The 'target follow-exec -off' variant takes no further arguments. The '-off' case turns off exec following via FollowExec(false, ""), and if extra tokens were supplied after '-off' the command rejects them as 'too many arguments'.
Source
Thrown at pkg/terminal/command.go:3572
if len(argv) == 1 {
if t.client.FollowExecEnabled() {
fmt.Fprintf(t.stdout, "Follow exec is enabled.\n")
} else {
fmt.Fprintf(t.stdout, "Follow exec is disabled.\n")
}
return nil
}
argv = config.Split2PartsBySpace(argv[1])
switch argv[0] {
case "-on":
var regex string
if len(argv) == 2 {
regex = argv[1]
}
t.client.FollowExec(true, regex)
case "-off":
if len(argv) > 1 {
return errors.New("too many arguments")
}
t.client.FollowExec(false, "")
default:
return fmt.Errorf("unknown argument %q to 'target follow-exec'", argv[0])
}
return nil
case "switch":
tgts, err := t.client.ListTargets()
if err != nil {
return err
}
pid, err := strconv.Atoi(argv[1])
if err != nil {
return err
}
found := false
for _, tgt := range tgts {
if tgt.Pid == pid {View on GitHub (pinned to a23773e6c3)
Solutions
- Use 'target follow-exec -off' with no additional arguments.
- If you meant to set a regex filter, use the enable form: 'target follow-exec -on <regex>' (or without -on) instead.
- Trim accidental extra tokens from the command.
Example fix
// before target follow-exec -off myregex // after target follow-exec -off
Defensive patterns
Strategy: validation
Validate before calling
if len(strings.Fields(cmd)) > 3 { return errors.New("target follow-exec -off takes no arguments") } Prevention
- Use 'target follow-exec -off' with no extra tokens.
- Use the enable form ('target follow-exec [regex]') when a regex filter is needed.
- Double-check for stray arguments in scripted commands.
When it happens
Trigger: Running 'target follow-exec -off <anything>', e.g. 'target follow-exec -off regex' or a stray extra token.
Common situations: Users assuming -off takes the same optional regex that the enable variant accepts (len(argv)==2 there), or leftover text in the command line.
Related errors
- clear-checkpoint argument must be a checkpoint ID
- wrong number of arguments to "config"
- command not available
- -o option specified with an output path
- no output path specified
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/e9afcea5c07b6a0f.
Report an issue: GitHub.