{"record":{"id":"93a04333636e1f79","repo":"go-delve/delve","slug":"internal-error-could-not-interpret-return-value-o","errorCode":null,"errorMessage":"internal error, could not interpret return value of mallocgc call","messagePattern":"internal error, could not interpret return value of mallocgc call","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/fncall.go","lineNumber":1117,"sourceCode":"\nfunc (scope *EvalScope) convertAllocToString(stack *evalStack) {\n\tmallocv := stack.pop()\n\tv := stack.pop()\n\n\tmallocv.loadValue(LoadFullValue())\n\n\tif mallocv.Unreadable != nil {\n\t\tstack.err = mallocv.Unreadable\n\t\treturn\n\t}\n\n\tif mallocv.DwarfType.String() != \"*void\" {\n\t\tstack.err = fmt.Errorf(\"unexpected return type for mallocgc call: %v\", mallocv.DwarfType.String())\n\t\treturn\n\t}\n\n\tif len(mallocv.Children) != 1 {\n\t\tstack.err = errors.New(\"internal error, could not interpret return value of mallocgc call\")\n\t\treturn\n\t}\n\n\tv.Base = mallocv.Children[0].Addr\n\t_, stack.err = scope.Mem.WriteMemory(v.Base, []byte(constant.StringVal(v.Value)))\n\tstack.push(v)\n}\n\nfunc isCallInjectionStop(t *Target, thread Thread, loc *Location) bool {\n\tif loc.Fn == nil {\n\t\treturn false\n\t}\n\tif !strings.HasPrefix(loc.Fn.Name, debugCallFunctionNamePrefix1) && !strings.HasPrefix(loc.Fn.Name, debugCallFunctionNamePrefix2) {\n\t\treturn false\n\t}\n\tif loc.PC == loc.Fn.Entry {\n\t\t// call injection just started, did not make any progress before being interrupted by a concurrent breakpoint.\n\t\treturn false","sourceCodeStart":1099,"sourceCodeEnd":1135,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/fncall.go#L1099-L1135","documentation":"When a string literal must be allocated during a call, Delve injects a call to runtime.mallocgc and then reads back the returned pointer. This internal error means mallocgc's return value did not have the expected shape (exactly one child) so Delve could not extract the new allocation's address. It signals a mismatch between Delve's expectations and the Go runtime's behavior/version, not user input.","triggerScenarios":"String allocation during call injection on a Go runtime whose mallocgc return value layout differs from what this Delve expects; corrupted or unreadable return-variable children after mallocgc completes.","commonSituations":"Running a newer/older Go toolchain than the Delve version supports; debugging binaries stripped of needed DWARF so return values parse incorrectly.","solutions":["Match your Delve version to your Go toolchain version (upgrade or downgrade one of them)","Retry the evaluation after stepping to a clean breakpoint state","Avoid expressions that force string allocation (print parts separately) as a workaround","File a Delve bug with the Go and Delve versions if it reproduces on supported combinations"],"exampleFix":"// before\ngo install github.com/go-delve/delve/cmd/dlv@latest # against older Go\n// after: pin a compatible pair\ngo1.24 + dlv v1.24.x (see Delve compatibility notes)","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := doStringAllocCall()\nif err != nil && strings.Contains(err.Error(), \"internal error, could not interpret return value of mallocgc\") {\n    // retry once on a supported Go/Delve combination; else report versions\n}","preventionTips":["Keep Delve version matched to the Go toolchain version","Avoid string-allocating expressions as a workaround","Reproduce on supported combos before filing a Delve issue","Record Go and Delve versions when reporting"],"tags":["debugger","function-call-injection","runtime-internals"],"backgroundTag":"mallocgc-return-mismatch","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}