go-delve/delve · error
breakpoint names that are relative paths are not supported
Error message
breakpoint names that are relative paths are not supported
What it means
When parsing a named breakpoint whose name starts with '.', the session rejects it because relative paths are not supported for breakpoint names. Names are resolved as function names or base-inclusive file paths, and a leading '.' indicates an ambiguous relative path that delve cannot map reliably.
Source
Thrown at service/dap/server.go:1873
hitCondition: want.HitCondition,
logMessage: "",
}
}, func(i int) (*bpLocation, error) {
want := request.Arguments.Breakpoints[i]
// Set the function breakpoint
spec, err := locspec.Parse(want.Name)
if err != nil {
return nil, err
}
if loc, ok := spec.(*locspec.NormalLocationSpec); !ok || loc.FuncBase == nil {
// Other locations do not make sense in the context of function breakpoints.
// Regex locations are likely to resolve to multiple places and offset locations
// are only meaningful at the time the breakpoint was created.
return nil, fmt.Errorf("breakpoint name %q could not be parsed as a function. name must be in the format 'funcName', 'funcName:line' or 'fileName:line'", want.Name)
}
if want.Name[0] == '.' {
return nil, errors.New("breakpoint names that are relative paths are not supported")
}
// Find the location of the function name. CreateBreakpoint requires the name to include the base
// (e.g. main.functionName is supported but not functionName).
// We first find the location of the function, and then set breakpoints for that location.
var locs []api.Location
locs, err = s.debugger.FindLocationSpec(-1, 0, 0, want.Name, spec, true, s.args.substitutePathClientToServer)
if err != nil {
return nil, err
}
if len(locs) == 0 {
return nil, err
}
if len(locs) > 1 {
s.config.log.Debugf("multiple locations found for %s", want.Name)
}
// Set breakpoint using the PCs that were found.
loc := locs[0]View on GitHub (pinned to a23773e6c3)
Solutions
- Use an absolute path (e.g. '/abs/path/main.go:10') in the breakpoint name
- Use the function form ('pkg.funcName:line') instead of a file path
- Configure the client/IDE to send absolute file paths (or fix path mappings) before creating breakpoints
Example fix
// before
{name: './cmd/app/main.go:42'}
// after
{name: '/home/user/proj/cmd/app/main.go:42'} Defensive patterns
Strategy: validation
Validate before calling
// reject relative-path breakpoint names before sending
if strings.HasPrefix(bp.Name, ".") {
return fmt.Errorf("use absolute path or function name: %s", bp.Name)
} Prevention
- Configure the IDE to send absolute file paths
- Prefer function-name breakpoint forms (pkg.Func:line)
- Normalize paths client-side before creating breakpoints
When it happens
Trigger: Sending a setBreakpoints request with name './main.go:10' or any './'-prefixed path; IDE passing workspace-relative file paths instead of absolute paths into name-based breakpoint locations.
Common situations: Client configurations that build breakpoint names from relative editor paths; users typing relative paths into a 'function or file' breakpoint field; remote debugging where paths were recorded relatively.
Related errors
- breakpoint already exists
- unable to set breakpoint
- call stopped
- cannot write a breakpoint to a core file
- multiple errors evaluating conditions
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/50e23755b9044a9c.
Report an issue: GitHub.