go-delve/delve · error
invalid character in breakpoint name '%c'
Error message
invalid character in breakpoint name '%c'
What it means
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.
Source
Thrown at service/api/types.go:161
// RootFuncName is the Root function from where tracing needs to be done
RootFuncName string
// TraceFollowCalls indicates the Depth of tracing
TraceFollowCalls int
}
// ValidBreakpointName returns an error if
// the name to be chosen for a breakpoint is invalid.
// The name can not be just a number, and must contain a series
// of letters or numbers.
func ValidBreakpointName(name string) error {
if _, err := strconv.Atoi(name); err == nil {
return errors.New("breakpoint name can not be a number")
}
for _, ch := range name {
if !(unicode.IsLetter(ch) || unicode.IsDigit(ch)) {
return fmt.Errorf("invalid character in breakpoint name '%c'", ch)
}
}
return nil
}
// WatchType is the watchpoint type
type WatchType uint8
const (
WatchRead WatchType = 1 << iota
WatchWrite
)
// Thread is a thread within the debugged process.
type Thread struct {
// ID is a unique identifier for the thread.
ID int `json:"id"`View on GitHub (pinned to a23773e6c3)
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.
Example fix
// before
bp := api.Breakpoint{Name: "my-breakpoint"}
// after
bp := api.Breakpoint{Name: "myBreakpoint"} Defensive patterns
Strategy: validation
Validate before calling
func isSafeBreakpointName(name string) error {
if _, err := strconv.Atoi(name); err == nil { return errors.New("name cannot be numeric") }
for _, ch := range name {
if !unicode.IsLetter(ch) && !unicode.IsDigit(ch) {
return fmt.Errorf("invalid char %q", ch)
}
}
return nil
} Try / catch
if err := api.ValidBreakpointName(name); err != nil {
name = sanitizeName(name) // strip non-alphanumerics and retry
} Prevention
- Generate names with letters/digits only
- Never use pure numbers as names
- Sanitize user-supplied names before calling
When it happens
Trigger: 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'.
Common situations: Using hyphens or dots out of habit; quoting names with spaces; naming a breakpoint after an ID ('42').
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- cannot write a breakpoint to a core file
- failed to open file '%s': %w
- failed to write breakpoint to file %s:%d
- breakpoint name %q could not be parsed as a function. name m
- invalid Filter pattern: %v
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/03dd16097d04d108.
Report an issue: GitHub.