{"record":{"id":"162a2fd5802a2cd8","repo":"go-delve/delve","slug":"internal-debugger-error-pinning-call-injection-se","errorCode":null,"errorMessage":"internal debugger error: pinning call injection seen before call to %s at instruction %d","messagePattern":"internal debugger error: pinning call injection seen before call to (.+?) at instruction (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/evalop/evalcompile.go","lineNumber":279,"sourceCode":"\t}\n\n\tdebugPinnerSeen := false\n\n\tfor i, op := range ctx.ops {\n\t\tnpop, npush := op.depthCheck()\n\t\tif depth[i] < npop {\n\t\t\treturn fmt.Errorf(\"internal debugger error: depth check error at instruction %d: expected at least %d have %d\\n%s\", i, npop, depth[i], Listing(depth, ctx.ops))\n\t\t}\n\t\td := depth[i] - npop + npush\n\t\tcheckAndSet(i+1, d)\n\t\tswitch op := op.(type) {\n\t\tcase *Jump:\n\t\t\tcheckAndSet(op.Target, d)\n\t\tcase *CallInjectionStartSpecial:\n\t\t\tdebugPinnerSeen = true\n\t\tcase *CallInjectionComplete:\n\t\t\tif op.DoPinning && !debugPinnerSeen {\n\t\t\t\terr = fmt.Errorf(\"internal debugger error: pinning call injection seen before call to %s at instruction %d\", DebugPinnerFunctionName, i)\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif depth[len(ctx.ops)] != endDepth {\n\t\treturn fmt.Errorf(\"internal debugger error: depth check failed: depth at the end is not %d (got %d)\\n%s\", depth[len(ctx.ops)], endDepth, Listing(depth, ctx.ops))\n\t}\n\treturn nil\n}\n\nfunc (ctx *compileCtx) compileAST(t ast.Expr, toplevel bool) error {\n\tswitch node := t.(type) {\n\tcase *ast.CallExpr:\n\t\tif f, ok := node.Fun.(*ast.SelectorExpr); ok && ctx.flags&BreakpointCondition != 0 {\n\t\t\tconst catch = \"catch\"","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/evalop/evalcompile.go#L261-L297","documentation":"Internal ordering check in the expression compiler: a `CallInjectionComplete` opcode with DoPinning=true was emitted before the required `CallInjectionStartSpecial` (debug pinner) call in the instruction stream, violating the protocol that pinning calls must be preceded by a debug-pinner injection. This indicates generated opcodes are out of order — an internal invariant violation.","triggerScenarios":"CompileAST/CompileSet compiling an expression that performs a pinning function call injection, where the compiler failed to emit DebugPinnerFunctionName's call-injection before the pinning call — triggered by delve compiler bugs around function calls inside breakpoint conditions or nested call expressions.","commonSituations":"Seen when using call injection in breakpoint conditions/watch expressions with delve builds where the pinning prelude emission is buggy, or when combining runtime.frame/catch constructs with calls in ways that confuse the compiler.","solutions":["Upgrade delve — pinning call-injection bugs are actively fixed upstream","Avoid function calls in breakpoint conditions; move the call out of the condition and inspect values by stepping instead","File a go-delve/delve issue with the minimal expression and the instruction listing"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"pinning call injection\") {\n    // remove call injection from the condition and re-set the breakpoint\n    setCondition(bp, \"true\")\n    log.Printf(\"pinning injection bug: %v\", err)\n}","preventionTips":["Avoid function-call injection inside breakpoint conditions; use plain data comparisons","When calls are needed, test them with `print` first, then move to conditions","Track delve releases for call-injection/pinning fixes"],"tags":["debugger","internal","call-injection","pinning","evalop"],"backgroundTag":"internal-invariant-violation","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}