ipfs/kubo · error

unknown pubsub router %s

Error message

unknown pubsub router %s

What it means

`Pubsub.Router` chooses the gossipsub/floodsub router implementation. The switch accepts "" (default), "gossipsub", and "floodsub"; any other value fails node construction. Thrown so an unsupported router name cannot silently degrade pubsub behavior.

Source

Thrown at core/node/groups.go:91

		switch configSeenMessagesStrategy {
		case config.LastSeenMessagesStrategy:
			seenMessagesStrategy = timecache.Strategy_LastSeen
		case config.FirstSeenMessagesStrategy:
			seenMessagesStrategy = timecache.Strategy_FirstSeen
		default:
			return fx.Error(fmt.Errorf("unsupported Pubsub.SeenMessagesStrategy %q", configSeenMessagesStrategy))
		}
		pubsubOptions = append(pubsubOptions, pubsub.WithSeenMessagesStrategy(seenMessagesStrategy))

		switch cfg.Pubsub.Router {
		case "":
			fallthrough
		case "gossipsub":
			ps = fx.Provide(libp2p.GossipSub(pubsubOptions...))
		case "floodsub":
			ps = fx.Provide(libp2p.FloodSub(pubsubOptions...))
		default:
			return fx.Error(fmt.Errorf("unknown pubsub router %s", cfg.Pubsub.Router))
		}
	}

	autonat := fx.Options()

	switch cfg.AutoNAT.ServiceMode {
	default:
		panic("BUG: unhandled autonat service mode")
	case config.AutoNATServiceDisabled:
	case config.AutoNATServiceUnset:
		// TODO
		//
		// We're enabling the AutoNAT service by default on _all_ nodes
		// for the moment.
		//
		// We should consider disabling it by default if the dht is set
		// to dhtclient.
		fallthrough

View on GitHub (pinned to 329838acdf)

Solutions

  1. Set `ipfs config Pubsub.Router gossipsub` (recommended) or "floodsub"
  2. Clear the value (`ipfs config Pubsub.Router ""`) to use the default gossipsub
  3. Check docs/config.md for supported router values in this Kubo version

Example fix

// before (config.json)
"Pubsub": { "Router": "randomsub" }
// after
"Pubsub": { "Router": "gossipsub" }
Defensive patterns

Strategy: validation

Validate before calling

switch r := cfg.Pubsub.Router; r {
case "", "gossipsub", "floodsub":
	// ok
default:
	return fmt.Errorf("Pubsub.Router %q unsupported", r)
}

Prevention

When it happens

Trigger: `Pubsub.Router` set to an unknown string (e.g. "randomsub", "flood", "gossip") while pubsub is enabled in the LibP2P fx group.

Common situations: Typo; copying configuration for a different IPFS implementation; expecting experimental routers to exist when they are not compiled in.

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/583194624af089a5. Report an issue: GitHub.