{"record":{"id":"004e204722a336f9","repo":"ipfs/kubo","slug":"incorrect-params-for-dht-router","errorCode":null,"errorMessage":"incorrect params for DHT router","messagePattern":"incorrect params for DHT router","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"routing/delegated.go","lineNumber":315,"sourceCode":"\tpk, err := base64.StdEncoding.DecodeString(keyB64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ic.UnmarshalPrivateKey(pk)\n}\n\ntype ExtraDHTParams struct {\n\tBootstrapPeers []peer.AddrInfo\n\tHost           host.Host\n\tValidator      record.Validator\n\tDatastore      datastore.Batching\n}\n\nfunc dhtRoutingFromConfig(conf config.Router, extra *ExtraDHTParams) (routing.Routing, error) {\n\tparams, ok := conf.Parameters.(*config.DHTRouterParams)\n\tif !ok {\n\t\treturn nil, errors.New(\"incorrect params for DHT router\")\n\t}\n\n\tif params.AcceleratedDHTClient {\n\t\treturn createFullRT(extra)\n\t}\n\n\tvar mode dht.ModeOpt\n\tswitch params.Mode {\n\tcase config.DHTModeAuto:\n\t\tmode = dht.ModeAuto\n\tcase config.DHTModeClient:\n\t\tmode = dht.ModeClient\n\tcase config.DHTModeServer:\n\t\tmode = dht.ModeServer\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid DHT mode: %q\", params.Mode)\n\t}\n","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/routing/delegated.go#L297-L333","documentation":"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.","triggerScenarios":"Thrown at routing/delegated.go:315 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make the Routers.<name> entry use the Parameters shape documented for DHT routers (Mode, AcceleratedDHTClient, etc.)","Or switch the entry's Type to match the parameters actually present","Reference: docs/config.md Routers section"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}