{"record":{"id":"5958aa8f3a37b115","repo":"go-delve/delve","slug":"function-calls-not-allowed-without-using-call","errorCode":null,"errorMessage":"function calls not allowed without using 'call'","messagePattern":"function calls not allowed without using 'call'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/evalop/evalcompile.go","lineNumber":20,"sourceCode":"\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"go/ast\"\n\t\"go/constant\"\n\t\"go/parser\"\n\t\"go/scanner\"\n\t\"go/token\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/go-delve/delve/pkg/astutil\"\n\t\"github.com/go-delve/delve/pkg/dwarf/godwarf\"\n\t\"github.com/go-delve/delve/pkg/dwarf/reader\"\n)\n\nvar (\n\tErrFuncCallNotAllowed         = errors.New(\"function calls not allowed without using 'call'\")\n\terrFuncCallNotAllowedLitAlloc = errors.New(\"literal can not be allocated because function calls are not allowed without using 'call'\")\n)\n\nconst (\n\tDelvePackage                       = \"delve\"\n\tBreakpointHitCountVarName          = \"bphitcount\"\n\tBreakpointHitCountVarNameQualified = DelvePackage + \".\" + BreakpointHitCountVarName\n\tDebugPinnerFunctionName            = \"runtime.debugPinnerV1\"\n)\n\ntype compileCtx struct {\n\tevalLookup\n\tops        []Op\n\tallowCalls bool\n\tcurCall    int\n\tflags      Flags\n\tpinnerUsed bool\n\thasCalls   bool","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/evalop/evalcompile.go#L2-L38","documentation":"ErrFuncCallNotAllowed is returned when an expression containing a function call is compiled while function-call injection is disabled, i.e. the expression was submitted without opting into 'call' semantics (EvalExpression vs EvalExpressionWithCalls). It is raised by compileFunctionCall, compileFunctionCallNoPinning, and evalCallInjectionStart in pkg/proc/evalop/evalcompile.go.","triggerScenarios":"Using the 'print'/'eval' command with an expression containing a call like print foo(1); service-layer EvaluateVariable on an expression with calls; any API path that uses CompileAST with call disallowed but the AST contains *ast.CallExpr.","commonSituations":"User forgets to prefix with 'call' in the Delve CLI; a watch/conditional-breakpoint expression includes a function call where calls are not permitted; RPC clients calling EvalExpression instead of EvalExpressionWithCalls.","solutions":["Use the 'call' command instead of 'print' for expressions that call functions: call foo(1)","For RPC/API clients, invoke EvalExpressionWithCalls with the appropriate CallKind instead of EvalExpression","Move the function call out of the expression and inspect its inputs/outputs separately"],"exampleFix":"// before\ndlv> print strings.ToUpper(s)\n// after\ndlv> call strings.ToUpper(s)","handlingStrategy":"validation","validationCode":"// client-side: only pass call expressions to EvalExpressionWithCalls\nimport \"go/ast\"\nfunc containsCall(e ast.Expr) bool {\n\tfound := false\n\tast.Inspect(e, func(n ast.Node) bool { if _, ok := n.(*ast.CallExpr); ok { found = true }; return !found })\n\treturn found\n}","typeGuard":null,"tryCatchPattern":"if errors.Is(err, evalop.ErrFuncCallNotAllowed) {\n    // re-issue via EvalExpressionWithCalls or the 'call' command\n}","preventionTips":["Use 'call' (not 'print') for any expression containing a function call","Keep watch expressions call-free; conditional breakpoints cannot call functions","For RPC clients, choose EvalExpressionWithCalls explicitly"],"tags":["go","function-call","eval","delve-cli"],"backgroundTag":"func-call-not-allowed","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}