go-delve/delve · error
clear-checkpoint argument must be a checkpoint ID
Error message
clear-checkpoint argument must be a checkpoint ID
What it means
clearCheckpoint validates the argument to the 'clear-checkpoint' terminal command before parsing it. A checkpoint ID must have the form 'c<N>' (e.g. 'c2'), where the leading character is literally 'c'. If the first character is not 'c', the command rejects the argument because it cannot be a valid checkpoint ID.
Source
Thrown at pkg/terminal/command.go:3412
if err != nil {
return err
}
w := new(tabwriter.Writer)
w.Init(t.stdout, 4, 4, 2, ' ', 0)
fmt.Fprintln(w, "ID\tWhen\tNote")
for _, cp := range cps {
fmt.Fprintf(w, "c%d\t%s\t%s\n", cp.ID, cp.When, cp.Where)
}
w.Flush()
return nil
}
func clearCheckpoint(t *Term, ctx callContext, args string) error {
if len(args) == 0 {
return errors.New("not enough arguments to clear-checkpoint")
}
if args[0] != 'c' {
return errors.New("clear-checkpoint argument must be a checkpoint ID")
}
id, err := strconv.Atoi(args[1:])
if err != nil {
return errors.New("clear-checkpoint argument must be a checkpoint ID")
}
return t.client.ClearCheckpoint(id)
}
func display(t *Term, ctx callContext, args string) error {
const (
addOption = "-a "
delOption = "-d "
)
switch {
case args == "":
t.printDisplays()
case strings.HasPrefix(args, addOption):View on GitHub (pinned to a23773e6c3)
Solutions
- Prefix the argument with 'c': use 'clear-checkpoint c2' instead of 'clear-checkpoint 2'.
- Run 'checkpoints' to list valid checkpoint IDs and use the exact ID shown.
- Check the source: strconv.Atoi parses args[1:], so only the 'c'+digits form is accepted.
Example fix
// before clear-checkpoint 2 // after clear-checkpoint c2
Defensive patterns
Strategy: validation
Validate before calling
func validCheckpointArg(s string) bool { return len(s) >= 2 && s[0] == 'c' }
// before calling: if !validCheckpointArg(arg) { prompt user for 'c<N>' form }
// in the terminal: clear-checkpoint c<N> Type guard
func isCheckpointID(s string) bool {
if len(s) < 2 || s[0] != 'c' { return false }
_, err := strconv.Atoi(s[1:])
return err == nil
} Prevention
- Always copy the checkpoint ID verbatim from the 'checkpoints' command output (it already includes the 'c' prefix).
- Validate the 'c<N>' format before invoking clear-checkpoint.
- Avoid hand-typing IDs; use the listed ID to prevent missing or malformed prefixes.
When it happens
Trigger: Running 'clear-checkpoint' with an argument whose first character is not 'c', e.g. 'clear-checkpoint 2' or 'clear-checkpoint x1'. Note that an empty argument yields the separate 'not enough arguments' error.
Common situations: Users type the numeric checkpoint ID without the 'c' prefix, forgetting the format that 'checkpoints' prints (IDs are displayed as c1, c2, ...). Copy-paste of only the number, or habit from other debuggers that use bare integers.
Related errors
- too many arguments
- 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/108bde616d900b20.
Report an issue: GitHub.