{"record":{"id":"0ab6c2be1014bc16","repo":"ipfs/kubo","slug":"provide-strategy-w","errorCode":null,"errorMessage":"Provide.Strategy: %w","messagePattern":"Provide\\.Strategy: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/provide.go","lineNumber":200,"sourceCode":"\treturn strategy, nil\n}\n\n// MustParseProvideStrategy is like ParseProvideStrategy but panics on error.\n// Use with strategy strings that have already been validated at startup.\nfunc MustParseProvideStrategy(s string) ProvideStrategy {\n\tstrategy, err := ParseProvideStrategy(s)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn strategy\n}\n\n// ValidateProvideConfig validates the Provide configuration according to DHT requirements.\nfunc ValidateProvideConfig(cfg *Provide) error {\n\t// Validate Provide.Strategy\n\tstrategy := cfg.Strategy.WithDefault(DefaultProvideStrategy)\n\tif _, err := ParseProvideStrategy(strategy); err != nil {\n\t\treturn fmt.Errorf(\"Provide.Strategy: %w\", err)\n\t}\n\n\t// Validate Provide.BloomFPRate\n\tif !cfg.BloomFPRate.IsDefault() {\n\t\trate := cfg.BloomFPRate.WithDefault(DefaultProvideBloomFPRate)\n\t\tif rate < MinProvideBloomFPRate {\n\t\t\treturn fmt.Errorf(\"Provide.BloomFPRate must be >= %d (1 in 1M), got %d\", MinProvideBloomFPRate, rate)\n\t\t}\n\t}\n\n\t// Validate Provide.DHT.Interval\n\tif !cfg.DHT.Interval.IsDefault() {\n\t\tinterval := cfg.DHT.Interval.WithDefault(DefaultProvideDHTInterval)\n\t\tif interval > amino.DefaultProvideValidity {\n\t\t\treturn fmt.Errorf(\"Provide.DHT.Interval (%v) must be less than or equal to DHT provider record validity (%v)\", interval, amino.DefaultProvideValidity)\n\t\t}\n\t\tif interval < 0 {\n\t\t\treturn fmt.Errorf(\"Provide.DHT.Interval must be non-negative, got %v\", interval)","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/config/provide.go#L182-L218","documentation":"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.","triggerScenarios":"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\".","commonSituations":"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.","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\""],"exampleFix":"// before (config file)\n\"Strategy\": \"all+pinned\"\n// after\n\"Strategy\": \"pinned\"","handlingStrategy":"validation","validationCode":"if s := cfg.Provide.Strategy.WithDefault(config.DefaultProvideStrategy); config.ParseProvideStrategy(s) != nil {\n\t// reject/fix config before starting the node\n}","typeGuard":"func strategyIsValid(s string) bool {\n\t_, err := config.ParseProvideStrategy(s)\n\treturn err == nil\n}","tryCatchPattern":"if err := config.ValidateProvideConfig(cfg.Provide); err != nil {\n\tvar revert bool\n\tif strings.HasPrefix(err.Error(), \"Provide.Strategy:\") { revert = true }\n\tif revert { restoreDefaultStrategy() }\n\treturn err\n}","preventionTips":["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"],"tags":["config","validation","provide-strategy"],"backgroundTag":"invalid-config-value","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}