ipfs/kubo · error

Provide.DHT.DedicatedBurstWorkers must be non-negative, got

Error message

Provide.DHT.DedicatedBurstWorkers must be non-negative, got %d

What it means

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).

Source

Thrown at config/provide.go:255

		maxWorkers := cfg.DHT.MaxWorkers.WithDefault(DefaultProvideDHTMaxWorkers)
		if maxWorkers <= 0 {
			return fmt.Errorf("Provide.DHT.MaxWorkers must be positive, got %d", maxWorkers)
		}
	}

	// Validate DedicatedPeriodicWorkers
	if !cfg.DHT.DedicatedPeriodicWorkers.IsDefault() {
		workers := cfg.DHT.DedicatedPeriodicWorkers.WithDefault(DefaultProvideDHTDedicatedPeriodicWorkers)
		if workers < 0 {
			return fmt.Errorf("Provide.DHT.DedicatedPeriodicWorkers must be non-negative, got %d", workers)
		}
	}

	// Validate DedicatedBurstWorkers
	if !cfg.DHT.DedicatedBurstWorkers.IsDefault() {
		workers := cfg.DHT.DedicatedBurstWorkers.WithDefault(DefaultProvideDHTDedicatedBurstWorkers)
		if workers < 0 {
			return fmt.Errorf("Provide.DHT.DedicatedBurstWorkers must be non-negative, got %d", workers)
		}
	}

	// Validate MaxProvideConnsPerWorker
	if !cfg.DHT.MaxProvideConnsPerWorker.IsDefault() {
		conns := cfg.DHT.MaxProvideConnsPerWorker.WithDefault(DefaultProvideDHTMaxProvideConnsPerWorker)
		if conns <= 0 {
			return fmt.Errorf("Provide.DHT.MaxProvideConnsPerWorker must be positive, got %d", conns)
		}
	}

	// Validate KeystoreBatchSize
	if !cfg.DHT.KeystoreBatchSize.IsDefault() {
		batchSize := cfg.DHT.KeystoreBatchSize.WithDefault(DefaultProvideDHTKeystoreBatchSize)
		if batchSize <= 0 {
			return fmt.Errorf("Provide.DHT.KeystoreBatchSize must be positive, got %d", batchSize)
		}
	}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Set the value to a non-negative integer (default 1)
  2. Remove the key to use the default
  3. Clamp computed values at zero in scripts

Example fix

// before
"DedicatedBurstWorkers": -2
// after
"DedicatedBurstWorkers": 1
Defensive patterns

Strategy: validation

Validate before calling

if w := cfg.Provide.DHT.DedicatedBurstWorkers; !w.IsDefault() && w.WithDefault(config.DefaultProvideDHTDedicatedBurstWorkers) < 0 {
	return errors.New("DedicatedBurstWorkers must be non-negative")
}

Try / catch

if err := config.ValidateProvideConfig(cfg.Provide); err != nil {
	if strings.Contains(err.Error(), "DedicatedBurstWorkers must be non-negative") {
		cfg.Provide.DHT.DedicatedBurstWorkers = nil
	}
	return err
}

Prevention

When it happens

Trigger: Node startup when Provide.DHT.DedicatedBurstWorkers is explicitly set to a negative integer, e.g. -2, in the config.

Common situations: Sign typo in hand-edited config; automation computing worker budgets that can go negative under load.

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


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