{"record":{"id":"7f272fb02de820f1","repo":"go-delve/delve","slug":"v-7f272f","errorCode":null,"errorMessage":"%v","messagePattern":"%v","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/fncall.go","lineNumber":853,"sourceCode":"\t}\n\n\tswitch regval {\n\tcase debugCallRegPrecheckFailed: // 8\n\t\tstack.callInjectionContinue = true\n\t\tarchoff := uint64(0)\n\t\tif bi.Arch.Name == \"arm64\" || bi.Arch.Name == \"loong64\" {\n\t\t\tarchoff = 8\n\t\t} else if bi.Arch.Name == \"ppc64le\" {\n\t\t\tarchoff = 40\n\t\t}\n\t\t// get error from top of the stack and return it to user\n\t\terrvar, err := readStackVariable(p, thread, regs, archoff, \"string\", LoadFullValue())\n\t\tif err != nil {\n\t\t\tfncall.err = fmt.Errorf(\"could not get precheck error reason: %v\", err)\n\t\t\tbreak\n\t\t}\n\t\terrvar.Name = \"err\"\n\t\tfncall.err = fmt.Errorf(\"%v\", constant.StringVal(errvar.Value))\n\n\tcase debugCallRegCompleteCall: // 0\n\t\tp.fncallForG[callScope.g.ID].startThreadID = 0\n\n\tcase debugCallRegRestoreRegisters: // 16\n\t\t// runtime requests that we restore the registers (all except pc and sp),\n\t\t// this is also the last step of the function call protocol.\n\t\tpc, sp := regs.PC(), regs.SP()\n\t\tif err := thread.RestoreRegisters(fncall.savedRegs); err != nil {\n\t\t\tfncall.err = fmt.Errorf(\"could not restore registers: %v\", err)\n\t\t}\n\t\tif err := setPC(thread, pc); err != nil {\n\t\t\tfncall.err = fmt.Errorf(\"could not restore PC: %v\", err)\n\t\t}\n\t\tif err := setSP(thread, sp); err != nil {\n\t\t\tfncall.err = fmt.Errorf(\"could not restore SP: %v\", err)\n\t\t}\n\t\tfncallLog(\"stepping thread %d\", thread.ThreadID())","sourceCodeStart":835,"sourceCodeEnd":871,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/fncall.go#L835-L871","documentation":"When the Go runtime rejects an injected function call (e.g. goroutine is in a non-callable state, stack too small, unsafepoint issues), it leaves an error string on the stack. Delve reads it with readStackVariable and rethrows it verbatim via fmt.Errorf(\"%v\", ...). This is the propagated runtime reason for the failed call injection.","triggerScenarios":"funcCallStep reads the debug-call error string from the stack during the precondition-check phase of debugCallV2 and the string is non-empty — the runtime refused the call.","commonSituations":"Calling a function while the goroutine is running or in a runtime critical section; calling functions from within runtime/internal frames; calling a function that grows the stack beyond limits; using 'call' inside a breakpoint in a signal handler or system goroutine.","solutions":["Read the wrapped message: it names the actual runtime reason (e.g. 'go exit status', 'not at a safe point')","Ensure the goroutine is stopped at a normal Go frame before calling","Avoid injecting calls from runtime or signal-handler frames","Retry after stepping the program to a safe location"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure the goroutine is in a callable state before 'call':\n// check state.CurrentThread.ReturnValues / frame is not in runtime or signal code\n// e.g. via disassemble/state: strings.Contains(frame.Fn.Name, \"runtime.\") == false","typeGuard":null,"tryCatchPattern":"err := dbg.CallFunction(scope, fn, args)\nif err != nil {\n\t// The wrapped text IS the runtime's reason: parse and surface it\n\tlog.Printf(\"call rejected by runtime: %v\", err)\n}\n","preventionTips":["Only inject calls from normal user-code frames","Avoid calling functions from signal handlers or system goroutines","Step out of runtime frames before calling","Read the wrapped message — it names the actual runtime objection"],"tags":["go","fncall","runtime","call-injection"],"backgroundTag":"fncall-runtime-reason-unreadable","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}