{"record":{"id":"18f5c7305d9c9f74","repo":"go-delve/delve","slug":"too-many-arguments-in-traced-function-max-is-12-i","errorCode":null,"errorMessage":"too many arguments in traced function, max is 12 input+return","messagePattern":"too many arguments in traced function, max is 12 input\\+return","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/native/proc_linux.go","lineNumber":959,"sourceCode":"\n\treturn linutil.EntryPointFromAuxv(auxvbuf, dbp.bi.Arch.PtrSize()), nil\n}\n\nfunc (dbp *nativeProcess) SetUProbe(fnName string, goidOffset int64, args []ebpf.UProbeArgMap) error {\n\t// Lazily load and initialize the BPF program upon request to set a uprobe.\n\tif dbp.os.ebpf == nil {\n\t\tvar err error\n\t\tdbp.os.ebpf, err = ebpf.LoadEBPFTracingProgram(dbp.bi.Images[0].Path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// We only allow up to 12 args for a BPF probe.\n\t// 6 inputs + 6 outputs.\n\t// Return early if we have more.\n\tif len(args) > 12 {\n\t\treturn errors.New(\"too many arguments in traced function, max is 12 input+return\")\n\t}\n\n\tfns := dbp.bi.LookupFunc()[fnName]\n\tif len(fns) != 1 {\n\t\treturn &proc.ErrFunctionNotFound{FuncName: fnName}\n\t}\n\tfn := fns[0]\n\n\tentryPC, err := proc.FirstPCAfterPrologue(dbp, fn, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toffset, err := dbp.BinInfo().GStructOffset(dbp.Memory())\n\tif err != nil {\n\t\treturn err\n\t}\n\tkey := entryPC","sourceCodeStart":941,"sourceCodeEnd":977,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/native/proc_linux.go#L941-L977","documentation":"When setting up an eBPF/uprobe-based tracepoint (SetUProbe), delve only supports up to 12 arguments total (6 register-passed inputs + 6 return slots) because of the eBPF scratch buffer and calling-convention limits. If the DWARF signature of the traced function requires more than 12 input+return slots, this error is returned and the probe is not installed.","triggerScenarios":"Calling SetUProbe (via `trace` command or rpc TraceFunction with followCalls/args) on a function whose signature sums to more than 12 input+return arguments.","commonSituations":"Tracing functions with long parameter lists; passing return-argument slots (`-r`) that push the total over 12; eBPF tracing on linux kernels without alternate arg passing.","solutions":["Trace a function with fewer parameters, or wrap the call site in a smaller helper function.","Reduce the number of requested return arguments with the trace command.","On amd64, remember only 6 register args are captured — parameters spilled to the stack cannot be traced; restructure the code.","Check the function signature count before calling SetUProbe."],"exampleFix":"// before\nfunc process(a,b,c,d,e,f,g,h,i,j,k,l,m int) {}\ndlvs trace process  // error: too many arguments\n// after\nfunc process(a,b,c,d,e,f,g,h,i,j,k,l int) {} // <= 12 slots\n// or trace a wrapper: func processSmall() { process(1,2,3,4,5,6,7,8,9,10,11,12,13) }","handlingStrategy":"validation","validationCode":"// count input + return args before calling SetUProbe\nfunc canTrace(fnName string, numReturns int) error {\n\tnumArgs := countArgsFromDWARF(fnName) // your DWARF/ELF lookup\n\tif numArgs+numReturns > 12 {\n\t\treturn fmt.Errorf(\"%s has %d args+rets; eBPF max is 12\", fnName, numArgs+numReturns)\n\t}\n\treturn nil\n}","typeGuard":"func isTooManyArgsErr(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"too many arguments in traced function\")\n}","tryCatchPattern":"err := dlv.SetUProbe(fnName, goidOff, args)\nif err != nil && strings.Contains(err.Error(), \"too many arguments\") {\n\t// fall back to breakpoint-based tracing instead of eBPF\n\treturn setSoftwareBreakpointTrace(fnName)\n}","preventionTips":["Keep traced function signatures at <= 6 register-passed arguments.","Count requested return slots (-r flags) into the 12-arg budget.","Remember stack-passed args beyond 6 registers can't be captured by uprobes.","Wrap large-signature functions in small wrappers for tracing."],"tags":["ebpf","uprobe","tracing","linux"],"backgroundTag":"too-many-arguments-trace","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}