{"record":{"id":"23392906e6dfedc3","repo":"go-delve/delve","slug":"breakpoint-name-q-could-not-be-parsed-as-a-functi","errorCode":null,"errorMessage":"breakpoint name %q could not be parsed as a function. name must be in the format 'funcName', 'funcName:line' or 'fileName:line'","messagePattern":"breakpoint name %q could not be parsed as a function\\. name must be in the format 'funcName', 'funcName:line' or 'fileName:line'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/dap/server.go","lineNumber":1869,"sourceCode":"\t\twant := request.Arguments.Breakpoints[i]\n\t\treturn &bpMetadata{\n\t\t\tname:         fmt.Sprintf(\"%s Name=%s\", functionBpPrefix, want.Name),\n\t\t\tcondition:    want.Condition,\n\t\t\thitCondition: want.HitCondition,\n\t\t\tlogMessage:   \"\",\n\t\t}\n\t}, func(i int) (*bpLocation, error) {\n\t\twant := request.Arguments.Breakpoints[i]\n\t\t// Set the function breakpoint\n\t\tspec, err := locspec.Parse(want.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif loc, ok := spec.(*locspec.NormalLocationSpec); !ok || loc.FuncBase == nil {\n\t\t\t// Other locations do not make sense in the context of function breakpoints.\n\t\t\t// Regex locations are likely to resolve to multiple places and offset locations\n\t\t\t// are only meaningful at the time the breakpoint was created.\n\t\t\treturn 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)\n\t\t}\n\n\t\tif want.Name[0] == '.' {\n\t\t\treturn nil, errors.New(\"breakpoint names that are relative paths are not supported\")\n\t\t}\n\t\t// Find the location of the function name. CreateBreakpoint requires the name to include the base\n\t\t// (e.g. main.functionName is supported but not functionName).\n\t\t// We first find the location of the function, and then set breakpoints for that location.\n\t\tvar locs []api.Location\n\t\tlocs, err = s.debugger.FindLocationSpec(-1, 0, 0, want.Name, spec, true, s.args.substitutePathClientToServer)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(locs) == 0 {\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(locs) > 1 {\n\t\t\ts.config.log.Debugf(\"multiple locations found for %s\", want.Name)","sourceCodeStart":1851,"sourceCodeEnd":1887,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/dap/server.go#L1851-L1887","documentation":"The DAP client requested a function breakpoint whose 'name' could not be resolved to a single function base. Delve only supports function breakpoints at plain function names, 'funcName:line' or 'fileName:line' locations whose parse yields a NormalLocationSpec with a FuncBase; regex or other location forms are rejected.","triggerScenarios":"setBreakpoints request with type 'function' where the breakpoint name parses to a non-Normal locspec, or a NormalLocationSpec whose FuncBase is nil (e.g. a bare file:line without a function, or a regex location).","commonSituations":"IDE users typing regex-like patterns or plain file:line into a 'function breakpoint' field, or tools sending fully qualified paths with line numbers that do not denote a function entry.","solutions":["Use a plain function name, e.g. 'main.main' or 'pkg.Type.Method'","Use 'funcName:line' to break at a line within the function","Use a regular (line) breakpoint at fileName:line instead of a function breakpoint if you do not target a function","Avoid relative paths (names starting with '.') — these are also unsupported"],"exampleFix":"// before (DAP setBreakpoints on functions)\n{\"breakpoints\":[{\"name\":\"foo.*:12\"}]}\n// after\n{\"breakpoints\":[{\"name\":\"main.foo\"}]}","handlingStrategy":"validation","validationCode":"var nameRe = regexp.MustCompile(`^[^\\s]+(:\\d+)?$`)\nfunc validFunctionBPName(n string) bool { return nameRe.MatchString(n) && !strings.HasPrefix(n, \".\") }","typeGuard":null,"tryCatchPattern":"if err := setFunctionBreakpoints(names); err != nil { if strings.Contains(err.Error(), \"could not be parsed as a function\") { /* fall back to line breakpoints */ } return err }","preventionTips":["Only send plain function names or funcName:line for function breakpoints","Use line breakpoints (setBreakpoints with source) for file:line targets","Never start names with '.' (relative paths unsupported)"],"tags":["dap","breakpoints","validation"],"backgroundTag":"invalid-breakpoint-location","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}