{"record":{"id":"108bde616d900b20","repo":"go-delve/delve","slug":"clear-checkpoint-argument-must-be-a-checkpoint-id","errorCode":null,"errorMessage":"clear-checkpoint argument must be a checkpoint ID","messagePattern":"clear-checkpoint argument must be a checkpoint ID","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/terminal/command.go","lineNumber":3412,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\tw := new(tabwriter.Writer)\n\tw.Init(t.stdout, 4, 4, 2, ' ', 0)\n\tfmt.Fprintln(w, \"ID\\tWhen\\tNote\")\n\tfor _, cp := range cps {\n\t\tfmt.Fprintf(w, \"c%d\\t%s\\t%s\\n\", cp.ID, cp.When, cp.Where)\n\t}\n\tw.Flush()\n\treturn nil\n}\n\nfunc clearCheckpoint(t *Term, ctx callContext, args string) error {\n\tif len(args) == 0 {\n\t\treturn errors.New(\"not enough arguments to clear-checkpoint\")\n\t}\n\tif args[0] != 'c' {\n\t\treturn errors.New(\"clear-checkpoint argument must be a checkpoint ID\")\n\t}\n\tid, err := strconv.Atoi(args[1:])\n\tif err != nil {\n\t\treturn errors.New(\"clear-checkpoint argument must be a checkpoint ID\")\n\t}\n\treturn t.client.ClearCheckpoint(id)\n}\n\nfunc display(t *Term, ctx callContext, args string) error {\n\tconst (\n\t\taddOption = \"-a \"\n\t\tdelOption = \"-d \"\n\t)\n\tswitch {\n\tcase args == \"\":\n\t\tt.printDisplays()\n\n\tcase strings.HasPrefix(args, addOption):","sourceCodeStart":3394,"sourceCodeEnd":3430,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/terminal/command.go#L3394-L3430","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nclear-checkpoint 2\n// after\nclear-checkpoint c2","handlingStrategy":"validation","validationCode":"func validCheckpointArg(s string) bool { return len(s) >= 2 && s[0] == 'c' }\n// before calling: if !validCheckpointArg(arg) { prompt user for 'c<N>' form }\n// in the terminal: clear-checkpoint c<N>","typeGuard":"func isCheckpointID(s string) bool {\n    if len(s) < 2 || s[0] != 'c' { return false }\n    _, err := strconv.Atoi(s[1:])\n    return err == nil\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["cli","argument-validation","delve"],"backgroundTag":"invalid-command-argument","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}