ipfs/kubo · error
got unexpected output from util.RmBlocks
Error message
got unexpected output from util.RmBlocks
What it means
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.
Source
Thrown at core/coreapi/block.go:119
return err
}
cids := []cid.Cid{rp.RootCid()}
o := util.RmBlocksOpts{Force: settings.Force}
out, err := util.RmBlocks(ctx, api.blockstore, api.pinning, cids, o)
if err != nil {
return err
}
select {
case res, ok := <-out:
if !ok {
return nil
}
remBlock, ok := res.(*util.RemovedBlock)
if !ok {
return errors.New("got unexpected output from util.RmBlocks")
}
if remBlock.Error != nil {
return remBlock.Error
}
return nil
case <-ctx.Done():
return ctx.Err()
}
}
func (api *BlockAPI) Stat(ctx context.Context, p path.Path) (coreiface.BlockStat, error) {
ctx, span := tracing.Span(ctx, "CoreAPI.BlockAPI", "Stat", trace.WithAttributes(attribute.String("path", p.String())))
defer span.End()
rp, _, err := api.core().ResolvePath(ctx, p)
if err != nil {
return nil, errView on GitHub (pinned to 329838acdf)
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
Defensive patterns
Strategy: try-catch
Type guard
remBlock, ok := res.(*util.RemovedBlock); !ok // skip -> error path already in library
Try / catch
err := api.Block().Rm(ctx, path, opts...)
if err != nil && strings.Contains(err.Error(), "got unexpected output from util.RmBlocks") {
return fmt.Errorf("internal block rm failure; rebuild with pinned deps: %w", err)
}
return err Prevention
- Build with pinned go.mod versions, no local replace directives
- Report reproducible cases upstream with kubo/boxo versions
- Use official release binaries
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- pin check failed: %w
- ipfs api address could not be found
- unexpected redirect
- unsupported file type '%s'
- cannot parse mode %s: %s
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/4253b5227240a200.
Report an issue: GitHub.