{"record":{"id":"3dfb92b969de73b7","repo":"go-delve/delve","slug":"can-not-call-function-with-nil-returninfoloadconfi","errorCode":null,"errorMessage":"can not call function with nil ReturnInfoLoadConfig","messagePattern":"can not call function with nil ReturnInfoLoadConfig","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/debugger/debugger.go","lineNumber":1149,"sourceCode":"\t}\n\n\tswitch command.Name {\n\tcase api.Continue:\n\t\td.log.Debug(\"continuing\")\n\t\tif err := d.target.ChangeDirection(proc.Forward); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = d.target.Continue()\n\tcase api.DirectionCongruentContinue:\n\t\td.log.Debug(\"continuing (direction congruent)\")\n\t\terr = d.target.Continue()\n\tcase api.Call:\n\t\td.log.Debugf(\"function call %s\", command.Expr)\n\t\tif err := d.target.ChangeDirection(proc.Forward); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif command.ReturnInfoLoadConfig == nil {\n\t\t\treturn nil, errors.New(\"can not call function with nil ReturnInfoLoadConfig\")\n\t\t}\n\t\tg := d.target.Selected.SelectedGoroutine()\n\t\tif command.GoroutineID > 0 {\n\t\t\tg, err = proc.FindGoroutine(d.target.Selected, command.GoroutineID)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\terr = proc.EvalExpressionWithCalls(d.target, g, command.Expr, *api.LoadConfigToProc(command.ReturnInfoLoadConfig), !command.UnsafeCall)\n\tcase api.Rewind:\n\t\td.log.Debug(\"rewinding\")\n\t\tif err := d.target.ChangeDirection(proc.Backward); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\terr = d.target.Continue()\n\tcase api.Next:\n\t\td.log.Debug(\"nexting\")\n\t\tif err := d.target.ChangeDirection(proc.Forward); err != nil {","sourceCodeStart":1131,"sourceCodeEnd":1167,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/debugger/debugger.go#L1131-L1167","documentation":"When injecting a function call (call command), Delve needs a ReturnInfoLoadConfig to know how to read the return value's variables/types from the stopped target. This error is thrown by Command when a Call command is issued with a nil ReturnInfoLoadConfig, because return values could not be loaded afterwards.","triggerScenarios":"Calling Debugger.Command (RPC2 service/command) with api.DebuggerCommand{Name: api.Call, Expr: ..., ReturnInfoLoadConfig: nil} and Forward direction.","commonSituations":"Custom frontends or scripts invoking the RPC call API directly and forgetting to populate ReturnInfoLoadConfig; older client code written before the field was required; wrappers that copy a DebuggerCommand struct but drop nested config pointers.","solutions":["Populate ReturnInfoLoadConfig with a valid *proc.LoadConfig before issuing the Call command","Use a LoadConfig matching your evaluation needs (e.g. FollowPointers, MaxVariableRecurse, MaxStringLen, MaxStructFields)","Upgrade/fix the calling frontend so it always sets the field for call commands"],"exampleFix":"// before\ncmd := &api.DebuggerCommand{Name: api.Call, Expr: \"fmt.Println(\\\"hi\\\")\"}\nd.Command(cmd, out)\n// after\ncmd := &api.DebuggerCommand{Name: api.Call, Expr: \"fmt.Println(\\\"hi\\\")\",\n    ReturnInfoLoadConfig: &proc.LoadConfig{FollowPointers: true, MaxVariableRecurse: 1, MaxStringLen: 64, MaxArrayValues: 64, MaxStructFields: -1}}\nd.Command(cmd, out)","handlingStrategy":"validation","validationCode":"if cmd.Name == api.Call && cmd.ReturnInfoLoadConfig == nil {\n    cmd.ReturnInfoLoadConfig = &proc.LoadConfig{\n        FollowPointers: true, MaxVariableRecurse: 1,\n        MaxStringLen: 64, MaxArrayValues: 64, MaxStructFields: -1,\n    }\n}","typeGuard":"func callCmdReady(cmd *api.DebuggerCommand) bool {\n    return cmd.Name != api.Call || cmd.ReturnInfoLoadConfig != nil\n}","tryCatchPattern":"out, err := dbg.Command(cmd, nil)\nif err != nil && strings.Contains(err.Error(), \"nil ReturnInfoLoadConfig\") {\n    cmd.ReturnInfoLoadConfig = defaultLoadConfig()\n    out, err = dbg.Command(cmd, nil)\n}","preventionTips":["Always construct call commands through a helper that fills LoadConfig defaults","Keep a shared defaultLoadConfig() in client code for evaluation and calls","Re-check struct fields after upgrading the delve API version"],"tags":["function-call","rpc","validation","config"],"backgroundTag":"nil-required-config","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}