{"record":{"id":"57313064865e6db3","repo":"ipfs/kubo","slug":"internal-error-v","errorCode":null,"errorMessage":"internal error: %v","messagePattern":"internal error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/commands.go","lineNumber":239,"sourceCode":"\t\t\t\t\t}\n\t\t\t\t\tres.SetLength(uint64(buf.Len()))\n\t\t\t\t\treturn res.Emit(&buf)\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}\n\ntype nonFatalError string\n\n// streamResult is a helper function to stream results that possibly\n// contain non-fatal errors.  The helper function is allowed to panic\n// on internal errors.\nfunc streamResult(procVal func(any, io.Writer) nonFatalError) func(cmds.Response, cmds.ResponseEmitter) error {\n\treturn func(res cmds.Response, re cmds.ResponseEmitter) (rerr error) {\n\t\tdefer func() {\n\t\t\tif r := recover(); r != nil {\n\t\t\t\trerr = fmt.Errorf(\"internal error: %v\", r)\n\t\t\t}\n\t\t}()\n\n\t\tvar errors bool\n\t\tfor {\n\t\t\tv, err := res.Next()\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\trerr = err\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\terrorMsg := procVal(v, os.Stdout)\n\n\t\t\tif errorMsg != \"\" {\n\t\t\t\terrors = true","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/commands.go#L221-L257","documentation":"streamResult wraps a recovered panic from a per-entry encoding/display function into an error via defer/recover. It signals a bug in the command's output encoder (index out of range, nil dereference, etc.) rather than bad user input; %v is the recovered panic value.","triggerScenarios":"Thrown at core/commands/commands.go:239 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Report the panic value and command to the kubo issue tracker","Update kubo; the encoder bug may already be fixed","Retry with a different output format (--enc) to route around the broken encoder"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}