ipfs/kubo · error
dependency loop creating router with name %q
Error message
dependency loop creating router with name %q
What it means
While recursively constructing the routing stack from the Routers config, a router (directly or through its SubRouters/Refs) depends on itself: the config's router dependency graph contains a cycle, so no valid construction order exists.
Source
Thrown at routing/delegated.go:107
return finalRouter, nil
}
func parse(visited map[string]bool,
createdRouters map[string]routing.Routing,
routerName string,
routersCfg config.Routers,
extraDHT *ExtraDHTParams,
extraHTTP *ExtraHTTPParams,
) (routing.Routing, error) {
// check if we already created it
r, ok := createdRouters[routerName]
if ok {
return r, nil
}
// check if we are in a dep loop
if visited[routerName] {
return nil, fmt.Errorf("dependency loop creating router with name %q", routerName)
}
// set node as visited
visited[routerName] = true
cfg, ok := routersCfg[routerName]
if !ok {
return nil, fmt.Errorf("config for router with name %q not found", routerName)
}
var router routing.Routing
var err error
switch cfg.Type {
case config.RouterTypeHTTP:
router, err = httpRoutingFromConfig(cfg.Router, extraHTTP)
case config.RouterTypeDHT:
router, err = dhtRoutingFromConfig(cfg.Router, extraDHT)
case config.RouterTypeParallel:View on GitHub (pinned to 329838acdf)
Solutions
- Inspect the Routers section and break the cycle (a router cannot reference itself via Refs/SubRouters, directly or indirectly)
- Redraw the intended dependency order and encode it as separate composable routers
- Reference: docs/config.md Routers section
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at routing/delegated.go:107 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/e4d1bffed41996bd.
Report an issue: GitHub.