ipfs/kubo · error

"all" strategy cannot be combined with other strategies in %

Error message

"all" strategy cannot be combined with other strategies in %q

What it means

'all' (or its alias 'flat') means provide every block in the store; it is mutually exclusive with the selective strategies (pinned, roots, mfs). ParseProvideStrategy rejects any combination where ProvideStrategyAll is set together with other bits and returns this error for the offending string.

Source

Thrown at config/provide.go:169

				return 0, fmt.Errorf("invalid provide strategy: empty token in %q", s)
			}
		case "pinned":
			strategy |= ProvideStrategyPinned
		case "roots":
			strategy |= ProvideStrategyRoots
		case "mfs":
			strategy |= ProvideStrategyMFS
		case "unique":
			strategy |= ProvideStrategyUnique
		case "entities":
			strategy |= ProvideStrategyEntities | ProvideStrategyUnique
		default:
			return 0, fmt.Errorf("unknown provide strategy token: %q in %q", part, s)
		}
	}
	// "all" provides every block and cannot be combined with selective strategies
	if strategy&ProvideStrategyAll != 0 && strategy != ProvideStrategyAll {
		return 0, fmt.Errorf("\"all\" strategy cannot be combined with other strategies in %q", s)
	}
	// +unique/+entities require a base strategy that walks DAGs (pinned and/or mfs)
	wantsDedup := strategy&(ProvideStrategyUnique|ProvideStrategyEntities) != 0
	if wantsDedup {
		walksDAGs := strategy&(ProvideStrategyPinned|ProvideStrategyMFS) != 0
		if !walksDAGs {
			return 0, fmt.Errorf("+unique/+entities must combine with pinned and/or mfs in %q", s)
		}
		if strategy&ProvideStrategyRoots != 0 {
			return 0, fmt.Errorf("+unique/+entities is incompatible with roots in %q", s)
		}
	}
	return strategy, nil
}

// MustParseProvideStrategy is like ParseProvideStrategy but panics on error.
// Use with strategy strings that have already been validated at startup.
func MustParseProvideStrategy(s string) ProvideStrategy {

View on GitHub (pinned to 329838acdf)

Solutions

  1. Pick one mode: use 'all' alone for full coverage, or drop 'all' and keep only selective tokens: ipfs config Provide.Strategy 'pinned+mfs'
  2. If the goal is bandwidth reduction, replace 'all' with 'pinned+mfs' (optionally '+unique')
  3. Reset to default: ipfs config Provide.Strategy '' (empty maps to 'all')

Example fix

// before
ipfs config Provide.Strategy 'all+pinned'
// after
ipfs config Provide.Strategy 'pinned'
Defensive patterns

Strategy: validation

Validate before calling

if (strings.Contains(s, "all") || strings.Contains(s, "flat")) && strings.ContainsAny(strings.TrimPrefix(strings.TrimPrefix(s, "all"), "flat"), "+") {
	return fmt.Errorf("'all' cannot be combined: %q", s)
}

Type guard

func isExclusiveAll(s string) bool {
	st, err := config.ParseProvideStrategy(s)
	_ = st
	return err != nil && strings.Contains(err.Error(), "cannot be combined")
}

Try / catch

strategy, err := config.ParseProvideStrategy(s)
if err != nil {
	return fmt.Errorf("Provide.Strategy %q invalid: %w", s, err)
}

Prevention

When it happens

Trigger: Setting Provide.Strategy to combinations like 'all+pinned', 'flat+mfs', or 'all+roots' — any string containing 'all'/'flat' plus at least one other token — at daemon startup or via ValidateProvideConfig.

Common situations: Appending a selective token to a default 'all' strategy when tuning provide bandwidth; scripted merging of strategy fragments that join 'all' with others; misunderstanding that 'all' is a base to be extended rather than an exclusive mode.

Related errors


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