{"record":{"id":"4253b5227240a200","repo":"ipfs/kubo","slug":"got-unexpected-output-from-util-rmblocks","errorCode":null,"errorMessage":"got unexpected output from util.RmBlocks","messagePattern":"got unexpected output from util\\.RmBlocks","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/coreapi/block.go","lineNumber":119,"sourceCode":"\t\treturn err\n\t}\n\tcids := []cid.Cid{rp.RootCid()}\n\to := util.RmBlocksOpts{Force: settings.Force}\n\n\tout, err := util.RmBlocks(ctx, api.blockstore, api.pinning, cids, o)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tselect {\n\tcase res, ok := <-out:\n\t\tif !ok {\n\t\t\treturn nil\n\t\t}\n\n\t\tremBlock, ok := res.(*util.RemovedBlock)\n\t\tif !ok {\n\t\t\treturn errors.New(\"got unexpected output from util.RmBlocks\")\n\t\t}\n\n\t\tif remBlock.Error != nil {\n\t\t\treturn remBlock.Error\n\t\t}\n\t\treturn nil\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n}\n\nfunc (api *BlockAPI) Stat(ctx context.Context, p path.Path) (coreiface.BlockStat, error) {\n\tctx, span := tracing.Span(ctx, \"CoreAPI.BlockAPI\", \"Stat\", trace.WithAttributes(attribute.String(\"path\", p.String())))\n\tdefer span.End()\n\n\trp, _, err := api.core().ResolvePath(ctx, p)\n\tif err != nil {\n\t\treturn nil, err","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/coreapi/block.go#L101-L137","documentation":"CoreAPI's block rm implementation iterates the channel returned by util.RmBlocks and expects every non-nil item to be a *util.RemovedBlock. If the channel yields any other type, this error is returned. It indicates an unexpected internal result type from the block-removal utility — typically a kubo/boxo version skew or a bug, not user input.","triggerScenarios":"Calling 'ipfs block rm' (RPC block/rm) when the underlying util.RmBlocks emits a value that is neither nil nor *util.RemovedBlock, e.g. after swapping boxo/go-blockservice versions where the result type changed.","commonSituations":"Running a kubo build with a manually pinned, incompatible boxo commit; custom plugins or forks altering the blockservice removal path; hitting a genuine upstream bug in a development build.","solutions":["Rebuild against the pinned dependencies (make build; do not use a local boxo replace directive)","Update or downgrade to an official kubo release where RmBlocks returns *util.RemovedBlock","If reproducible on a stock build, file a bug with the kubo repository including the CID and command used","As a workaround, remove blocks via 'ipfs repo gc' if appropriate"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"remBlock, ok := res.(*util.RemovedBlock); !ok // skip -> error path already in library","tryCatchPattern":"err := api.Block().Rm(ctx, path, opts...)\nif err != nil && strings.Contains(err.Error(), \"got unexpected output from util.RmBlocks\") {\n    return fmt.Errorf(\"internal block rm failure; rebuild with pinned deps: %w\", err)\n}\nreturn err","preventionTips":["Build with pinned go.mod versions, no local replace directives","Report reproducible cases upstream with kubo/boxo versions","Use official release binaries"],"tags":["blockstore","internal-error","rpc"],"backgroundTag":"unexpected-internal-result-type","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"}