{"record":{"id":"7b5f5f8fbf183abf","repo":"go-delve/delve","slug":"breakpoint-name-can-not-be-a-number","errorCode":null,"errorMessage":"breakpoint name can not be a number","messagePattern":"breakpoint name can not be a number","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/api/types.go","lineNumber":156,"sourceCode":"\tTotalHitCount uint64 `json:\"totalHitCount\"`\n\t// Disabled flag, signifying the state of the breakpoint\n\tDisabled bool `json:\"disabled\"`\n\n\tUserData any `json:\"-\"`\n\n\t// RootFuncName is the Root function from where tracing needs to be done\n\tRootFuncName string\n\t// TraceFollowCalls indicates the Depth of tracing\n\tTraceFollowCalls int\n}\n\n// ValidBreakpointName returns an error if\n// the name to be chosen for a breakpoint is invalid.\n// The name can not be just a number, and must contain a series\n// of letters or numbers.\nfunc ValidBreakpointName(name string) error {\n\tif _, err := strconv.Atoi(name); err == nil {\n\t\treturn errors.New(\"breakpoint name can not be a number\")\n\t}\n\n\tfor _, ch := range name {\n\t\tif !(unicode.IsLetter(ch) || unicode.IsDigit(ch)) {\n\t\t\treturn fmt.Errorf(\"invalid character in breakpoint name '%c'\", ch)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// WatchType is the watchpoint type\ntype WatchType uint8\n\nconst (\n\tWatchRead WatchType = 1 << iota\n\tWatchWrite\n)","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/api/types.go#L138-L174","documentation":"ValidBreakpointName validates user-chosen breakpoint names: the name must not be parseable as an integer and must consist only of letters/digits. Purely numeric names collide with Delve's auto-assigned numeric breakpoint IDs, so they are rejected with this error.","triggerScenarios":"Calling ValidBreakpointName (directly or via breakpoint creation APIs that accept a name) with values like \"42\", \"007\", or \"0\".","commonSituations":"IDEs that let users name breakpoints and get a name from a numeric input field; scripts generating sequential numeric names for breakpoints; localization of names into digit-only forms.","solutions":["Prefix numeric names with a letter, e.g. \"bp42\" instead of \"42\"","Validate with unicode.IsLetter/IsDigit before submitting","Map user-facing numeric labels to an internal alphabetic scheme"],"exampleFix":"// before\napi.ValidBreakpointName(\"42\")\n// after\napi.ValidBreakpointName(\"bp42\")","handlingStrategy":"validation","validationCode":"func validBPName(name string) bool {\n\tif _, err := strconv.Atoi(name); err == nil { return false }\n\tfor _, ch := range name {\n\t\tif !unicode.IsLetter(ch) && !unicode.IsDigit(ch) { return false }\n\t}\n\treturn len(name) > 0\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefix numeric names with a letter","Sanitize names to letters/digits before submission","Never auto-generate purely numeric names"],"tags":["breakpoint","validation","naming"],"backgroundTag":"invalid-identifier-name","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}