ipfs/kubo · error

cannot convert to CIDv0 with any multibase other than the im

Error message

cannot convert to CIDv0 with any multibase other than the implicit base58btc

What it means

When converting a CID to version 0, only the implicit base58btc multibase is valid. CIDv0 predates multibase, so requesting v0 with any other explicit --multibase (e.g. base32) is rejected at option-processing time.

Source

Thrown at core/commands/cid.go:98

			var codec mc.Code
			err := codec.Set(codecStr)
			if err != nil {
				return err
			}
			opts.newCodec = uint64(codec)
		} // otherwise, leave it as 0 (not a valid IPLD codec)

		switch verStr {
		case "":
			if baseStr != "" {
				opts.verConv = toCidV1
			}
		case "0":
			if opts.newCodec != 0 && opts.newCodec != cid.DagProtobuf {
				return errors.New("cannot convert to CIDv0 with any codec other than dag-pb")
			}
			if baseStr != "" && baseStr != "base58btc" {
				return errors.New("cannot convert to CIDv0 with any multibase other than the implicit base58btc")
			}
			opts.verConv = toCidV0
		case "1":
			opts.verConv = toCidV1
		default:
			return fmt.Errorf("invalid cid version: %q", verStr)
		}

		if baseStr != "" {
			encoder, err := mbase.EncoderByName(baseStr)
			if err != nil {
				return err
			}
			opts.newBase = encoder.Encoding()
		} else {
			opts.newBase = mbase.Encoding(-1)
		}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Omit --multibase (or set it to base58btc) when using --cid-ver=0
  2. Use --cid-ver=1 together with --multibase=base32 for base32 output
  3. Post-encode the v0 CID string yourself with a different multibase after conversion

Example fix

// before
ipfs cid format --cid-ver=0 --multibase=base32 <cid>
// after
ipfs cid format --cid-ver=1 --multibase=base32 <cid>
Defensive patterns

Strategy: validation

Validate before calling

if ver == 0 && base != "" && base != "base58btc" {
    return fmt.Errorf("multibase %s incompatible with CIDv0", base)
}

Try / catch

if err != nil && strings.Contains(err.Error(), "multibase other than base58btc") {
    // retry with --cid-ver=1
}

Prevention

When it happens

Trigger: Running `ipfs cid format --cid-ver=0 --multibase=base32 <cid>` (or any base other than base58btc, or an empty codec plus non-base58btc base) via CLI or the underlying option map.

Common situations: Wanting lowercase/base32 output but keeping v0; mixing flags from a v1-conversion invocation; scripts templating --multibase for all conversions.

Related errors


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/9d71c199b400eba9. Report an issue: GitHub.