ipfs/kubo · error

incorrect params for DHT router

Error message

incorrect params for DHT router

What it means

Type-guard failure while building a DHT router from config: a router entry with a DHT type has Parameters that are not *config.DHTRouterParams -- the config was hand-edited or malformed so the parameters do not match the declared router type.

Source

Thrown at routing/delegated.go:315

	pk, err := base64.StdEncoding.DecodeString(keyB64)
	if err != nil {
		return nil, err
	}

	return ic.UnmarshalPrivateKey(pk)
}

type ExtraDHTParams struct {
	BootstrapPeers []peer.AddrInfo
	Host           host.Host
	Validator      record.Validator
	Datastore      datastore.Batching
}

func dhtRoutingFromConfig(conf config.Router, extra *ExtraDHTParams) (routing.Routing, error) {
	params, ok := conf.Parameters.(*config.DHTRouterParams)
	if !ok {
		return nil, errors.New("incorrect params for DHT router")
	}

	if params.AcceleratedDHTClient {
		return createFullRT(extra)
	}

	var mode dht.ModeOpt
	switch params.Mode {
	case config.DHTModeAuto:
		mode = dht.ModeAuto
	case config.DHTModeClient:
		mode = dht.ModeClient
	case config.DHTModeServer:
		mode = dht.ModeServer
	default:
		return nil, fmt.Errorf("invalid DHT mode: %q", params.Mode)
	}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Make the Routers.<name> entry use the Parameters shape documented for DHT routers (Mode, AcceleratedDHTClient, etc.)
  2. Or switch the entry's Type to match the parameters actually present
  3. Reference: docs/config.md Routers section
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at routing/delegated.go:315 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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