{"record":{"id":"6564f10f6d5d77a2","repo":"go-delve/delve","slug":"condition-expression-unreadable-v","errorCode":null,"errorMessage":"condition expression unreadable: %v","messagePattern":"condition expression unreadable: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/breakpoints.go","lineNumber":528,"sourceCode":"\tv, err := stack.result(nil)\n\tif err != nil {\n\t\tif stack.disabledErrors {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, fmt.Errorf(\"error evaluating expression: %v\", err)\n\t}\n\tif v.Kind != reflect.Bool {\n\t\tif stack.disabledErrors {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, errors.New(\"condition expression not boolean\")\n\t}\n\tv.loadValue(LoadFullValue())\n\tif v.Unreadable != nil {\n\t\tif stack.disabledErrors {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn true, fmt.Errorf(\"condition expression unreadable: %v\", v.Unreadable)\n\t}\n\treturn constant.BoolVal(v.Value), nil\n}\n\n// NoBreakpointError is returned when trying to\n// clear a breakpoint that does not exist.\ntype NoBreakpointError struct {\n\tAddr uint64\n}\n\nfunc (nbp NoBreakpointError) Error() string {\n\treturn fmt.Sprintf(\"no breakpoint at %#v\", nbp.Addr)\n}\n\n// BreakpointMap represents an (address, breakpoint) map.\ntype BreakpointMap struct {\n\tM map[uint64]*Breakpoint\n","sourceCodeStart":510,"sourceCodeEnd":546,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/breakpoints.go#L510-L546","documentation":"Delve evaluates a conditional breakpoint's expression and loads the resulting value from the debuggee's memory. If the loaded value is unreadable (bad address, process gone, corrupted memory), the condition cannot be evaluated, so Delve aborts evaluation with this error instead of silently deciding the condition is false.","triggerScenarios":"Calling SetBreakpoint/checkCond with an expression like 'bpcond==1' whose variable cannot be read at hit time (uninitialized pointer, out-of-scope variable, stale stack frame), i.e. scope.evalExpression succeeds but v.loadValue(LoadFullValue()) sets v.Unreadable.","commonSituations":"Breakpoint condition references a variable that is optimized out or whose backing memory is not mapped yet; attaching to a process whose pages are swapped/unmapped; condition written for one function but breakpoint also placed at other call sites where the variable is invalid.","solutions":["Fix the condition expression so it only references variables valid and readable at the breakpoint location","Check the wrapped Unreadable message (%v suffix) to identify the bad address or variable and guard the condition with nil checks (e.g. 'p != nil && p.x == 1')","Remove the condition and filter manually in the CLI instead of evaluating a fragile expression","Rebuild the target binary with optimizations disabled (-gcflags='all=-N -l') so variables stay readable"],"exampleFix":"// before\nbreak cond p.x == 1\n// after\nbreak cond p != nil && p.x == 1","handlingStrategy":"try-catch","validationCode":"v, err := scope.EvalExpression(expr, LoadFullValue())\nif err != nil || v.Unreadable != nil { /* fix condition before attaching */ }","typeGuard":"func conditionReadable(v *proc.Variable) bool { return v != nil && v.Unreadable == nil && v.Value != nil }","tryCatchPattern":"bp, err := db.SetBreakpoint(...)\n// at hit time the error surfaces as evaluate failure:\nif err != nil && strings.Contains(err.Error(), \"condition expression unreadable\") { db.ClearBreakpoint(id); /* re-set with guarded condition */ }","preventionTips":["Prefix pointer dereferences in conditions with nil checks","Avoid conditions on variables known to be optimized out; use a plain breakpoint and filter in the client","Build targets with -gcflags='all=-N -l' during debugging sessions","Read the wrapped %v message to identify the unreadable expression component"],"tags":["debugger","breakpoints","go","conditions"],"backgroundTag":"breakpoint-condition-unreadable","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}