{"record":{"id":"71c59c0922c68bb1","repo":"go-delve/delve","slug":"internal-debugger-error-eval-program-finished-wit","errorCode":null,"errorMessage":"internal debugger error: eval program finished without error but %d call injections still active","messagePattern":"internal debugger error: eval program finished without error but (.+?) call injections still active","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/eval.go","lineNumber":1032,"sourceCode":"\t}\n\tstack.run()\n}\n\nfunc (stack *evalStack) run() {\n\tscope, curthread := stack.scope, stack.curthread\n\tfor stack.opidx < len(stack.ops) && stack.err == nil {\n\t\tstack.callInjectionContinue = false\n\t\tstack.executeOp()\n\t\t// If the instruction we just executed requests the call injection\n\t\t// protocol by setting callInjectionContinue we switch to it.\n\t\tif stack.callInjectionContinue && stack.err == nil {\n\t\t\tscope.callCtx.injectionThread = nil\n\t\t\treturn\n\t\t}\n\t}\n\n\tif stack.err == nil && len(stack.fncalls) > 0 {\n\t\tstack.err = fmt.Errorf(\"internal debugger error: eval program finished without error but %d call injections still active\", len(stack.fncalls))\n\t\treturn\n\t}\n\n\t// If there is an error we must undo all currently executing call\n\t// injections before returning.\n\n\tif len(stack.fncalls) > 0 {\n\t\tfncallLog(\"undoing calls (%v)\", stack.err)\n\t\tfncall := stack.fncallPeek()\n\t\tif fncall == stack.lastRetiredFncall {\n\t\t\tstack.err = fmt.Errorf(\"internal debugger error: could not undo injected call during error recovery, original error: %v\", stack.err)\n\t\t\treturn\n\t\t}\n\t\tif fncall.undoInjection != nil {\n\t\t\tif fncall.undoInjection.doComplete2 {\n\t\t\t\t// doComplete2 is set if CallInjectionComplete{DoPinning: true} has been\n\t\t\t\t// executed but CallInjectionComplete2 hasn't.\n\t\t\t\tregs, err := curthread.Registers()","sourceCodeStart":1014,"sourceCodeEnd":1050,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/eval.go#L1014-L1050","documentation":"run() executes the evalop program, suspending to run call-injection protocols when needed. When the program finishes without an error but stack.fncalls still holds active call injections, the debugger's internal state machine is inconsistent — every successful injection should have been retired. This is flagged as an internal debugger error because it indicates a bug in the call-injection protocol, not user error.","triggerScenarios":"An evalop program containing function-call operations (EvalExpression/SetVariable with function calls) completes with stack.err == nil while len(stack.fncalls) > 0 — i.e. the injected call never observed its completion breakpoint or the retirement path was skipped, so run() detects leftover active injections at the end.","commonSituations":"Injected call targets that never return normally (runtime exits, deadlocks, panics swallowed elsewhere); debugging targets where the call-injection completion event is missed (attached processes, coredumps, or recordings where injection cannot run); hitting this during record/replay (Record) where injections interact badly with the recorder.","solutions":["Report to go-delve/delve with the expression, Go version, and target platform — this indicates a debugger bug.","Avoid function-call expressions in contexts that cannot support injection (coredump targets, some recordings); evaluate plain expressions instead.","Update Delve; injection protocol bugs are frequently fixed across Go toolchain releases.","Retry the operation in a live (non-recorded) debug session where the full injection protocol can execute."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before evaluating call expressions, ensure the target supports injection\nif targetCoreDump || isRecording {\n    return errors.New(\"function-call expressions are unsupported on this target type\")\n}","typeGuard":"func supportsCallInjection(t *proc.Target) bool { return t != nil && !t.IsCoreDump() }","tryCatchPattern":"_, err := scope.EvalExpression(expr, cfg)\nif err != nil && strings.Contains(err.Error(), \"call injections still active\") {\n    // treat as debugger bug: log expression+platform, restart the debug session\n    log.Printf(\"injection leak on %q: %v\", expr, err)\n}","preventionTips":["Avoid function-call expressions in coredump or record/replay sessions","Keep Delve and the Go toolchain versions matched and current","Prefer plain (call-free) expressions for conditions and scripted evaluation","Restart the session after this error; internal state is inconsistent"],"tags":["go","debugger","call-injection","internal-error"],"backgroundTag":"call-injection-stuck","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}