{"record":{"id":"3730d758a8562011","repo":"go-delve/delve","slug":"breakpoint-d-can-not-be-enabled","errorCode":null,"errorMessage":"breakpoint %d can not be enabled","messagePattern":"breakpoint (.+?) can not be enabled","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/target_group.go","lineNumber":395,"sourceCode":"\t\treturn nil\n\t}\n\tvar err error\n\tvar addrs []uint64\n\tswitch {\n\tcase lbp.Set.File != \"\":\n\t\taddrs, err = FindFileLocation(p, lbp.Set.File, lbp.Set.Line)\n\tcase lbp.Set.FunctionName != \"\":\n\t\taddrs, err = FindFunctionLocation(p, lbp.Set.FunctionName, lbp.Set.Line)\n\tcase len(lbp.Set.PidAddrs) > 0:\n\t\tfor _, pidAddr := range lbp.Set.PidAddrs {\n\t\t\tif pidAddr.Pid == p.Pid() {\n\t\t\t\taddrs = append(addrs, pidAddr.Addr)\n\t\t\t}\n\t\t}\n\tcase lbp.Set.Expr != nil:\n\t\taddrs = lbp.Set.Expr(p)\n\tdefault:\n\t\treturn fmt.Errorf(\"breakpoint %d can not be enabled\", lbp.LogicalID)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, addr := range addrs {\n\t\t_, err = p.SetBreakpoint(lbp.LogicalID, addr, UserBreakpoint, nil)\n\t\tif err != nil {\n\t\t\tif _, isexists := err.(BreakpointExistsError); isexists {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn err\n}","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/target_group.go#L377-L413","documentation":"enableBreakpointOnTarget could not resolve any address source for the logical breakpoint: the breakpoint's Set spec had no File, FunctionName, PidAddrs, or Expr, so Delve has no way to compute where to place it. This indicates a LogicalBreakpoint constructed programmatically with an empty/unknown location spec, not a user-location problem.","triggerScenarios":"Calling enableBreakpoint (via SetBreakpointEnabled(true), addTarget, pluginOpenCallback) on a LogicalBreakpoint whose Set struct has all fields zero-valued — e.g. a breakpoint deserialized from an RPC/API payload that dropped the location, or an internal breakpoint whose spec was never filled in.","commonSituations":"Custom tooling creating LogicalBreakpoint values directly via API instead of using SetBreakpoint with a parsed location; API clients (rpc2/DAP) sending empty location fields; version skew where a serialized breakpoint config no longer matches the struct.","solutions":["Create breakpoints through the public SetBreakpoint/File:Line/FunctionName APIs so Set is populated","Check that the location you passed (file, function name, or address) is non-empty and reached the LogicalBreakpoint","If restoring breakpoints from config, re-parse the location string instead of copying an empty Set","Log/inspect lbp.Set before enabling to confirm which field should carry the location"],"exampleFix":"// before\nlbp := &proc.LogicalBreakpoint{LogicalID: id}\ngrp.SetBreakpointEnabled(lbp, true) // \"breakpoint 5 can not be enabled\"\n// after\nlbp.Set.File = \"main.go\"\nlbp.Set.Line = 42\n// or better: use the debugger-level API which parses the location for you\ndebugger.CreateBreakpoint(..., \"main.go:42\", ...)","handlingStrategy":"validation","validationCode":"func validLocation(lbp *proc.LogicalBreakpoint) bool {\n    s := lbp.Set\n    return s.File != \"\" || s.FunctionName != \"\" || len(s.PidAddrs) > 0 || s.Expr != nil\n}\n// call before enabling: if !validLocation(lbp) { fix the Set spec }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always create breakpoints through APIs that populate LogicalBreakpoint.Set from a parsed location string","Never construct LogicalBreakpoint values directly with an empty Set","When restoring saved breakpoints, re-parse the original location string rather than deserializing a bare struct","Unit-test any code that builds breakpoints programmatically to assert Set is non-empty"],"tags":["go","debugger","breakpoint","invalid-state"],"backgroundTag":"breakpoint-no-location","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}