ipfs/kubo · error

inline-limit %d exceeds maximum allowed size of %d bytes

Error message

inline-limit %d exceeds maximum allowed size of %d bytes

What it means

`ipfs add --inline` embeds small files directly into the CID as an identity multihash; `--inline-limit` caps how many bytes may be inlined. Kubo rejects a limit above verifcid.DefaultMaxIdentityDigestSize (128 bytes) because oversized identity multihashes are forbidden by the verifcid safety rules and break CID verification and interop.

Source

Thrown at core/commands/add.go:347

		silent, _ := req.Options[silentOptionName].(bool)
		chunker, _ := req.Options[chunkerOptionName].(string)
		dopin, _ := req.Options[pinOptionName].(bool)
		pinName, pinNameSet := req.Options[pinNameOptionName].(string)
		rawblks, rbset := req.Options[rawLeavesOptionName].(bool)
		maxFileLinks, maxFileLinksSet := req.Options[maxFileLinksOptionName].(int)
		maxDirectoryLinks, maxDirectoryLinksSet := req.Options[maxDirectoryLinksOptionName].(int)
		maxHAMTFanout, maxHAMTFanoutSet := req.Options[maxHAMTFanoutOptionName].(int)
		var sizeEstimationMode uio.SizeEstimationMode
		nocopy, _ := req.Options[noCopyOptionName].(bool)
		fscache, _ := req.Options[fstoreCacheOptionName].(bool)
		cidVer, cidVerSet := req.Options[cidVersionOptionName].(int)
		hashFunStr, _ := req.Options[hashOptionName].(string)
		inline, _ := req.Options[inlineOptionName].(bool)
		inlineLimit, _ := req.Options[inlineLimitOptionName].(int)

		// Validate inline-limit doesn't exceed the maximum identity digest size
		if inline && inlineLimit > verifcid.DefaultMaxIdentityDigestSize {
			return fmt.Errorf("inline-limit %d exceeds maximum allowed size of %d bytes", inlineLimit, verifcid.DefaultMaxIdentityDigestSize)
		}

		// Validate pin name
		if pinNameSet {
			if err := cmdutils.ValidatePinName(pinName); err != nil {
				return err
			}
		}

		toFilesStr, toFilesSet := req.Options[toFilesOptionName].(string)
		preserveMode, _ := req.Options[preserveModeOptionName].(bool)
		preserveMtime, _ := req.Options[preserveMtimeOptionName].(bool)
		mode, _ := req.Options[modeOptionName].(uint)
		mtime, _ := req.Options[mtimeOptionName].(int64)
		mtimeNsecs, _ := req.Options[mtimeNsecsOptionName].(uint)
		fastProvideRoot, fastProvideRootSet := req.Options[fastProvideRootOptionName].(bool)
		fastProvideDAG, fastProvideDAGSet := req.Options[fastProvideDAGOptionName].(bool)
		fastProvideWait, fastProvideWaitSet := req.Options[fastProvideWaitOptionName].(bool)

View on GitHub (pinned to 329838acdf)

Solutions

  1. Lower --inline-limit to <= 128 (default is 32)
  2. Pass --inline-limit only together with --inline and keep it within the cap
  3. Don't use inline CIDs for bigger payloads; add normally and reference the CID

Example fix

// before
ipfs add --inline --inline-limit=256 file.txt
// after
ipfs add --inline --inline-limit=32 file.txt
Defensive patterns

Strategy: validation

Validate before calling

const maxInline = 128
if inline && (inlineLimit <= 0 || inlineLimit > maxInline) {
  return fmt.Errorf("--inline-limit must be between 1 and %d", maxInline)
}

Prevention

When it happens

Trigger: Running `ipfs add --inline --inline-limit=N` (or RPC add with Inline=true, InlineLimit=N) where N > 128. Only fires when --inline is set; a large --inline-limit without --inline passes this check.

Common situations: Copying inline-limit values from pre-cap go-ipfs examples; setting a huge limit to try to inline whole small files; scripts computing the limit from input size.

Related errors


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