{"record":{"id":"36bca08f201de2ba","repo":"go-delve/delve","slug":"not-a-go-function","errorCode":null,"errorMessage":"not a Go function","messagePattern":"not a Go function","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/fncall.go","lineNumber":67,"sourceCode":"// must be also called in a loop until it returns false.\n\nconst (\n\tdebugCallFunctionNamePrefix1 = \"debugCall\"\n\tdebugCallFunctionNamePrefix2 = \"runtime.debugCall\"\n\tmaxDebugCallVersion          = 2\n\tmaxArgFrameSize              = 65535\n)\n\nvar (\n\terrFuncCallUnsupported        = errors.New(\"function calls not supported by this version of Go\")\n\terrFuncCallUnsupportedBackend = errors.New(\"backend does not support function calls\")\n\terrFuncCallInProgress         = errors.New(\"cannot call function while another function call is already in progress\")\n\terrNoGoroutine                = errors.New(\"no goroutine selected\")\n\terrGoroutineNotRunning        = errors.New(\"selected goroutine not running\")\n\terrNotEnoughStack             = errors.New(\"not enough stack space\")\n\terrTooManyArguments           = errors.New(\"too many arguments\")\n\terrNotEnoughArguments         = errors.New(\"not enough arguments\")\n\terrNotAGoFunction             = errors.New(\"not a Go function\")\n\terrFuncCallNotAllowedStrAlloc = errors.New(\"literal string can not be allocated because function calls are not allowed without using 'call'\")\n)\n\ntype functionCallState struct {\n\t// savedRegs contains the saved registers\n\tsavedRegs Registers\n\t// err contains a saved error\n\terr error\n\t// expr is the expression being evaluated\n\texpr *ast.CallExpr\n\t// fn is the function that is being called\n\tfn *Function\n\t// receiver is the receiver argument for the function\n\treceiver *Variable\n\t// closureAddr is the address of the closure being called\n\tclosureAddr uint64\n\t// formalArgs are the formal arguments of fn\n\tformalArgs []funcCallArg","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/fncall.go#L49-L85","documentation":"Delve throws this when the expression being called does not resolve to a Go function symbol. Call injection needs a Go function (with DWARF DIE, known calling convention and prologue) to inject; calling C assembly, a non-function value, or something the binary info cannot map to a function aborts with this error.","triggerScenarios":"`call someVar` where someVar is not a function; calling a raw assembly (non-Go, cu.isgo false) function; calling through an unresolved symbol at the current breakpoint.","commonSituations":"Trying to call runtime assembly routines (e.g. runtime.duffzero) directly; calling a function from a package compiled without Go DWARF linkage; typos that resolve to a variable instead of a function.","solutions":["Call an actual Go function written in Go source, not assembly or C","Verify the expression resolves to a function with `print <expr>`","Call a small Go wrapper function you add around the low-level routine","Use breakpoints/step commands to observe assembly code instead of call injection"],"exampleFix":"// before\n(dlv) call runtime.duffzero // assembly, not a Go function\n// after: wrap it\n(dlv) call myZero(buf) // myZero is a Go func that calls runtime memclr APIs","handlingStrategy":"validation","validationCode":"// confirm the callee is a Go function first\n(dlv) print fnName\n// in code: resolve and check before injecting\nfn := bi.PCToFunc(addr)\nif fn == nil || !fn.CU.IsGo { /* do not inject */ }","typeGuard":null,"tryCatchPattern":"if err := scope.CallFunction(expr); err != nil && err.Error() == \"not a Go function\" {\n    // fall back to a Go wrapper or step-through debugging\n}","preventionTips":["Only call functions written in Go source","Wrap assembly/runtime routines in a Go helper before calling","Check `print <expr>` resolves to a function before calling","Avoid calling symbols from non-Go-compiled code"],"tags":["debugger","function-call-injection","symbol-resolution"],"backgroundTag":"not-a-go-function","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}