go-delve/delve · error
not enough arguments for 'target'
Error message
not enough arguments for 'target'
What it means
The 'target' terminal command dispatches on its first argument (subcommand). With no subcommand at all (bare 'target'), it returns this error. Valid subcommands include e.g. listing targets and 'follow-exec'.
Source
Thrown at pkg/terminal/command.go:3600
return err
}
pid, err := strconv.Atoi(argv[1])
if err != nil {
return err
}
found := false
for _, tgt := range tgts {
if tgt.Pid == pid {
found = true
t.client.SwitchThread(tgt.CurrentThread.ID)
}
}
if !found {
return fmt.Errorf("could not find target %d", pid)
}
return nil
case "":
return errors.New("not enough arguments for 'target'")
default:
return fmt.Errorf("unknown command 'target %s'", argv[0])
}
}
func formatBreakpointName(bp *api.Breakpoint, upcase bool) string {
thing := "breakpoint"
if bp.Tracepoint {
thing = "tracepoint"
}
if bp.WatchExpr != "" {
thing = "watchpoint"
}
if upcase {
thing = strings.ToUpper(string(thing[0])) + thing[1:]
}
id := bp.Name
if id == "" {View on GitHub (pinned to a23773e6c3)
Solutions
- Provide a subcommand, e.g. 'target list' to show all targets, or 'target follow-exec ...'.
- Run 'help target' to see the available subcommands.
- If you wanted the current target information, use the appropriate subcommand rather than bare 'target'.
Example fix
// before target // after target list
Defensive patterns
Strategy: validation
Validate before calling
if strings.TrimSpace(cmdline) == "target" { return errors.New("target requires a subcommand, e.g. 'target list'") } Prevention
- Always include a subcommand after 'target'.
- Use 'target list' to enumerate debugged processes.
- Run 'help target' to discover valid subcommands.
When it happens
Trigger: Running 'target' with no arguments, so the switch matches the empty-string case.
Common situations: Users expecting a bare 'target' to list all debugged processes, or pressing the command before completing it.
Related errors
- no output path specified
- command not available
- clear-checkpoint argument must be a checkpoint ID
- -o option specified with an output path
- too many arguments
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/67b40b2ea5eae8a7.
Report an issue: GitHub.