{"record":{"id":"19be438dde08d8a0","repo":"ipfs/kubo","slug":"provide-dht-dedicatedburstworkers-must-be-non-nega","errorCode":null,"errorMessage":"Provide.DHT.DedicatedBurstWorkers must be non-negative, got %d","messagePattern":"Provide\\.DHT\\.DedicatedBurstWorkers must be non-negative, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/provide.go","lineNumber":255,"sourceCode":"\t\tmaxWorkers := cfg.DHT.MaxWorkers.WithDefault(DefaultProvideDHTMaxWorkers)\n\t\tif maxWorkers <= 0 {\n\t\t\treturn fmt.Errorf(\"Provide.DHT.MaxWorkers must be positive, got %d\", maxWorkers)\n\t\t}\n\t}\n\n\t// Validate DedicatedPeriodicWorkers\n\tif !cfg.DHT.DedicatedPeriodicWorkers.IsDefault() {\n\t\tworkers := cfg.DHT.DedicatedPeriodicWorkers.WithDefault(DefaultProvideDHTDedicatedPeriodicWorkers)\n\t\tif workers < 0 {\n\t\t\treturn fmt.Errorf(\"Provide.DHT.DedicatedPeriodicWorkers must be non-negative, got %d\", workers)\n\t\t}\n\t}\n\n\t// Validate DedicatedBurstWorkers\n\tif !cfg.DHT.DedicatedBurstWorkers.IsDefault() {\n\t\tworkers := cfg.DHT.DedicatedBurstWorkers.WithDefault(DefaultProvideDHTDedicatedBurstWorkers)\n\t\tif workers < 0 {\n\t\t\treturn fmt.Errorf(\"Provide.DHT.DedicatedBurstWorkers must be non-negative, got %d\", workers)\n\t\t}\n\t}\n\n\t// Validate MaxProvideConnsPerWorker\n\tif !cfg.DHT.MaxProvideConnsPerWorker.IsDefault() {\n\t\tconns := cfg.DHT.MaxProvideConnsPerWorker.WithDefault(DefaultProvideDHTMaxProvideConnsPerWorker)\n\t\tif conns <= 0 {\n\t\t\treturn fmt.Errorf(\"Provide.DHT.MaxProvideConnsPerWorker must be positive, got %d\", conns)\n\t\t}\n\t}\n\n\t// Validate KeystoreBatchSize\n\tif !cfg.DHT.KeystoreBatchSize.IsDefault() {\n\t\tbatchSize := cfg.DHT.KeystoreBatchSize.WithDefault(DefaultProvideDHTKeystoreBatchSize)\n\t\tif batchSize <= 0 {\n\t\t\treturn fmt.Errorf(\"Provide.DHT.KeystoreBatchSize must be positive, got %d\", batchSize)\n\t\t}\n\t}","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/config/provide.go#L237-L273","documentation":"Provide.DHT.DedicatedBurstWorkers reserves sweep-mode workers for burst (new-content) provides; negative counts are invalid. ValidateProvideConfig rejects explicitly set negative values, while 0 remains legal (no dedicated burst workers).","triggerScenarios":"Node startup when Provide.DHT.DedicatedBurstWorkers is explicitly set to a negative integer, e.g. -2, in the config.","commonSituations":"Sign typo in hand-edited config; automation computing worker budgets that can go negative under load.","solutions":["Set the value to a non-negative integer (default 1)","Remove the key to use the default","Clamp computed values at zero in scripts"],"exampleFix":"// before\n\"DedicatedBurstWorkers\": -2\n// after\n\"DedicatedBurstWorkers\": 1","handlingStrategy":"validation","validationCode":"if w := cfg.Provide.DHT.DedicatedBurstWorkers; !w.IsDefault() && w.WithDefault(config.DefaultProvideDHTDedicatedBurstWorkers) < 0 {\n\treturn errors.New(\"DedicatedBurstWorkers must be non-negative\")\n}","typeGuard":null,"tryCatchPattern":"if err := config.ValidateProvideConfig(cfg.Provide); err != nil {\n\tif strings.Contains(err.Error(), \"DedicatedBurstWorkers must be non-negative\") {\n\t\tcfg.Provide.DHT.DedicatedBurstWorkers = nil\n\t}\n\treturn err\n}","preventionTips":["Clamp computed values at zero before writing the config","Note 0 is legal (no dedicated burst workers); only negatives are rejected","Validate the whole Provide.DHT block after edits"],"tags":["config","validation","dht","workers"],"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"}