ipfs/kubo · error
Provide.Strategy: %w
Error message
Provide.Strategy: %w
What it means
ValidateProvideConfig parses the configured Provide.Strategy value and, if ParseProvideStrategy rejects it, wraps the underlying error with the "Provide.Strategy: " prefix so the failing config section is identified. It fires for any invalid strategy string: unknown tokens, empty tokens, "all" combined with other tokens, dedup modifiers without a DAG-walking base, or dedup combined with roots.
Source
Thrown at config/provide.go:200
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 {
strategy, err := ParseProvideStrategy(s)
if err != nil {
panic(err)
}
return strategy
}
// ValidateProvideConfig validates the Provide configuration according to DHT requirements.
func ValidateProvideConfig(cfg *Provide) error {
// Validate Provide.Strategy
strategy := cfg.Strategy.WithDefault(DefaultProvideStrategy)
if _, err := ParseProvideStrategy(strategy); err != nil {
return fmt.Errorf("Provide.Strategy: %w", err)
}
// Validate Provide.BloomFPRate
if !cfg.BloomFPRate.IsDefault() {
rate := cfg.BloomFPRate.WithDefault(DefaultProvideBloomFPRate)
if rate < MinProvideBloomFPRate {
return fmt.Errorf("Provide.BloomFPRate must be >= %d (1 in 1M), got %d", MinProvideBloomFPRate, rate)
}
}
// Validate Provide.DHT.Interval
if !cfg.DHT.Interval.IsDefault() {
interval := cfg.DHT.Interval.WithDefault(DefaultProvideDHTInterval)
if interval > amino.DefaultProvideValidity {
return fmt.Errorf("Provide.DHT.Interval (%v) must be less than or equal to DHT provider record validity (%v)", interval, amino.DefaultProvideValidity)
}
if interval < 0 {
return fmt.Errorf("Provide.DHT.Interval must be non-negative, got %v", interval)View on GitHub (pinned to 329838acdf)
Solutions
- Read the wrapped inner message to identify the exact problem (unknown token, empty token, invalid combination)
- Set Provide.Strategy to a valid value such as "all", "flat", "pinned", "roots", "mfs", "pinned+unique", or "mfs+entities"
- Delete the Provide.Strategy key from the config to restore the default "all"
Example fix
// before (config file) "Strategy": "all+pinned" // after "Strategy": "pinned"
Defensive patterns
Strategy: validation
Validate before calling
if s := cfg.Provide.Strategy.WithDefault(config.DefaultProvideStrategy); config.ParseProvideStrategy(s) != nil {
// reject/fix config before starting the node
} Type guard
func strategyIsValid(s string) bool {
_, err := config.ParseProvideStrategy(s)
return err == nil
} Try / catch
if err := config.ValidateProvideConfig(cfg.Provide); err != nil {
var revert bool
if strings.HasPrefix(err.Error(), "Provide.Strategy:") { revert = true }
if revert { restoreDefaultStrategy() }
return err
} Prevention
- Only use documented tokens: all, flat, pinned, roots, mfs, unique, entities
- Avoid empty tokens (no trailing '+' in the string)
- Remember "all" cannot be combined with any other token
When it happens
Trigger: Starting the IPFS node or any path calling ValidateProvideConfig when cfg.Provide.Strategy holds a string that ParseProvideStrategy rejects, e.g. "bogus", "pinned+", "all+pinned", "unique", or "pinned+roots+unique".
Common situations: Typo in the strategy string in the repo config; hand-edited config with a stray '+'; old or third-party tooling writing strategy values this kubo version no longer accepts.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Provide.Strategy='flat' is no longer supported. Use 'all' in
- +unique/+entities is incompatible with roots in %q
- private network does not work with Routing.Type=auto. Update
- invalid configuration: Provide.DHT.MaxWorkers cannot be 0 wh
- Routing.Type=delegated does not support content providing. S
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/0ab6c2be1014bc16.
Report an issue: GitHub.