go-delve/delve · error
unknown argument %q to exit
Error message
unknown argument %q to exit
What it means
The `exit` command accepts only a small set of options (`-c` to continue, `-d` to detach without killing, or none). Any other argument reaches the default case and is rejected with this message; ExitRequestError is never returned, so the debugger session does not exit.
Source
Thrown at pkg/terminal/command.go:3182
for _, bp := range bps {
if bp.ID >= 0 {
hasUserBreakpoints = true
break
}
}
if hasUserBreakpoints {
yes, _ := yesno(t.line, "There are breakpoints set, do you wish to quit and continue without clearing breakpoints? [Y/n] ", "yes")
if !yes {
return nil
}
}
t.quitContinue = true
case "-d":
t.detachNoKill = true
case "":
// no arguments
default:
return fmt.Errorf("unknown argument %q to exit", args)
}
return ExitRequestError{}
}
func getBreakpointByIDOrName(t *Term, arg string) (*api.Breakpoint, error) {
if id, err := strconv.Atoi(arg); err == nil {
return t.client.GetBreakpoint(id)
}
return t.client.GetBreakpointByName(arg)
}
func (c *Commands) onCmd(t *Term, ctx callContext, argstr string) error {
args := config.Split2PartsBySpace(argstr)
if len(args) < 2 {
return errors.New("not enough arguments")
}
View on GitHub (pinned to a23773e6c3)
Solutions
- Use bare `exit` to quit
- Use `exit -c` to continue the program then exit
- Use `exit -d` to detach without killing the process
- Check spelling/case of the flag: only -c and -d are valid
Example fix
// before exit now // after exit -d
Defensive patterns
Strategy: try-catch
Try / catch
switch arg {
case "", "-c", "-d":
// proceed
default:
return fmt.Errorf("unsupported exit arg %q", arg)
} Prevention
- Whitelist the three accepted forms in any scripting layer
When it happens
Trigger: Typing `exit now`, `exit -q`, or any flag other than `-c`/`-d` at the Delve prompt.
Common situations: Habit from other CLIs (`quit!`, `exit 0`); typos like `exit -C` (case-sensitive flags); passing a shell-style argument after exit.
Related errors
- command not available
- you must specify a thread
- too many arguments to goroutine
- not enough arguments
- Invalid frame %d
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/2ab62bd347b8b94a.
Report an issue: GitHub.