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

  1. Replace invalid characters with letters/digits only: 'my-break' -> 'mybreak' or 'MyBreak2'.
  2. Do not use a pure number as a name.
  3. 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

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

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/03dd16097d04d108. Report an issue: GitHub.