{"record":{"id":"03dd16097d04d108","repo":"go-delve/delve","slug":"invalid-character-in-breakpoint-name-c","errorCode":null,"errorMessage":"invalid character in breakpoint name '%c'","messagePattern":"invalid character in breakpoint name '%c'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/api/types.go","lineNumber":161,"sourceCode":"\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)\n\n// Thread is a thread within the debugged process.\ntype Thread struct {\n\t// ID is a unique identifier for the thread.\n\tID int `json:\"id\"`","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/api/types.go#L143-L179","documentation":"ValidBreakpointName enforces that breakpoint names contain only Unicode letters and digits and are not purely numeric. The first offending character is reported with %c. This keeps breakpoint names distinguishable from breakpoint IDs.","triggerScenarios":"Calling ValidBreakpointName (via breakpoint 'name' configuration in RPC or terminal) with a name containing punctuation, spaces, or symbols, e.g. 'my-break', 'bp 1', 'main.loop'.","commonSituations":"Using hyphens or dots out of habit; quoting names with spaces; naming a breakpoint after an ID ('42').","solutions":["Replace invalid characters with letters/digits only: 'my-break' -> 'mybreak' or 'MyBreak2'.","Do not use a pure number as a name.","Keep names alphanumeric - underscores are also rejected."],"exampleFix":"// before\nbp := api.Breakpoint{Name: \"my-breakpoint\"}\n// after\nbp := api.Breakpoint{Name: \"myBreakpoint\"}","handlingStrategy":"validation","validationCode":"func isSafeBreakpointName(name string) error {\n\tif _, err := strconv.Atoi(name); err == nil { return errors.New(\"name cannot be numeric\") }\n\tfor _, ch := range name {\n\t\tif !unicode.IsLetter(ch) && !unicode.IsDigit(ch) {\n\t\t\treturn fmt.Errorf(\"invalid char %q\", ch)\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"if err := api.ValidBreakpointName(name); err != nil {\n\tname = sanitizeName(name) // strip non-alphanumerics and retry\n}","preventionTips":["Generate names with letters/digits only","Never use pure numbers as names","Sanitize user-supplied names before calling"],"tags":["validation","breakpoints","delve"],"backgroundTag":"invalid-identifier-name","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}