{"record":{"id":"4dc826e0e752e3c8","repo":"go-delve/delve","slug":"could-not-load-q-v","errorCode":null,"errorMessage":"could not load %q: %v","messagePattern":"could not load %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/eval.go","lineNumber":2073,"sourceCode":"\treturn minmaxBuiltin(\"min\", token.LSS, args, nodeargs)\n}\n\nfunc maxBuiltin(args []*Variable, nodeargs []ast.Expr) (*Variable, error) {\n\treturn minmaxBuiltin(\"max\", token.GTR, args, nodeargs)\n}\n\nfunc minmaxBuiltin(name string, op token.Token, args []*Variable, nodeargs []ast.Expr) (*Variable, error) {\n\tvar best *Variable\n\n\tfor i := range args {\n\t\tif args[i].Kind == reflect.String {\n\t\t\targs[i].loadValue(loadFullValueLongerStrings)\n\t\t} else {\n\t\t\targs[i].loadValue(LoadFullValue())\n\t\t}\n\n\t\tif args[i].Unreadable != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not load %q: %v\", astutil.ExprToString(nodeargs[i]), args[i].Unreadable)\n\t\t}\n\t\tif args[i].FloatSpecial != 0 {\n\t\t\treturn nil, errOperationOnSpecialFloat\n\t\t}\n\n\t\tif best == nil {\n\t\t\tbest = args[i]\n\t\t\tcontinue\n\t\t}\n\n\t\t_, err := negotiateType(op, args[i], best)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tv, err := compareOp(op, args[i], best)\n\t\tif err != nil {\n\t\t\treturn nil, err","sourceCodeStart":2055,"sourceCodeEnd":2091,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/eval.go#L2055-L2091","documentation":"When evaluating a function call expression, Delve loads each argument variable's full value before passing it to the called function. If any argument's underlying memory or DWARF data cannot be read (loadValue sets Variable.Unreadable), the whole call evaluation is aborted with this error. It is thrown from the argument-evaluation loop in pkg/proc/eval.go:2073.","triggerScenarios":"Calling a function in the debuggee (call <fn>(<args>)) where an argument expression evaluates to a variable whose loadValue fails: reading its memory faults (dead/unmapped address), or the variable is a CPU register/special variable that cannot be loaded with the requested full-value load (loadFullValueLongerStrings or LoadFullValue()).","commonSituations":"Debugging a process whose memory layout changed (e.g. inspecting a core dump where the pointed-to page is not in the dump), calling functions with pointer arguments to freed/unreadable memory, or evaluating in frames where variables live in registers not available in the current frame.","solutions":["Fix the argument expression so it refers to readable memory (e.g. use a live local variable instead of a stale pointer).","If debugging a core dump, ensure the memory pages backing the argument were captured, or use a core captured with full mappings.","Simplify the argument (print it first with 'print <expr>') to confirm it is readable before using it in a call.","If the variable is a register-backed value, dereference or copy it into memory first, or avoid calls that need its full value."],"exampleFix":"// before\ndlv> call fmt.Println(ptr.String())   // ptr points to unreadable memory\n// error: could not load \"ptr.String()\": ... unreadable\n// after\ndlv> print ptr          // verify the pointer is valid first\ndlv> call fmt.Println(*ptr)  // or use a valid local: call fmt.Println(s)","handlingStrategy":"validation","validationCode":"// In the dlv CLI, before using the arg in a call:\n// dlv> print <argExpr>\n// Programmatic check after evaluating the argument:\nif v, err := scope.EvalExpression(argExpr, LoadConfig{FollowPointers: true}); err != nil || v.Unreadable != nil {\n    // do not use this argument in a call\n}","typeGuard":null,"tryCatchPattern":"// Delve returns errors as values; wrap the eval/call:\nres, err := scope.EvalExpression(callExpr, cfg)\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"could not load \") {\n        // fix or skip the offending argument expression\n    }\n}","preventionTips":["print every argument expression before using it in a call","avoid calling functions with pointers into unmapped/freed memory","when using core dumps, verify the needed memory is present","prefer live locals over stale pointer dereferences as call arguments"],"tags":["debugger","go","expression-evaluation","variable-loading"],"backgroundTag":"variable-unreadable","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}