ipfs/kubo · error

support for IPFS_REUSEPORT was removed. Use LIBP2P_TCP_REUSE

Error message

support for IPFS_REUSEPORT was removed. Use LIBP2P_TCP_REUSEPORT instead

What it means

The IPFS_REUSEPORT environment variable was removed from Kubo; validateDaemonEnvironment fails daemon startup when it is set, directing users to the replacement LIBP2P_TCP_REUSEPORT. It exists so stale env settings fail loudly instead of being silently ignored and changing network behavior.

Source

Thrown at cmd/ipfs/kubo/daemon.go:995

		return errors.New("Provide.Strategy='flat' is no longer supported. Use 'all' instead. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#providestrategy")
	}
	if cfg.Experimental.StrategicProviding {
		return errors.New("Experimental.StrategicProviding was removed. Remove it from your config. Documentation: https://github.com/ipfs/kubo/blob/master/docs/experimental-features.md#strategic-providing")
	}
	if cfg.Provide.DHT.SweepEnabled.WithDefault(config.DefaultProvideDHTSweepEnabled) &&
		cfg.Provide.DHT.MaxWorkers.WithDefault(config.DefaultProvideDHTMaxWorkers) == 0 {
		return errors.New("invalid configuration: Provide.DHT.MaxWorkers cannot be 0 when Provide.DHT.SweepEnabled=true. Set Provide.DHT.MaxWorkers to a positive value (e.g., 16) to control resource usage. Documentation: https://github.com/ipfs/kubo/blob/master/docs/config.md#providedhtmaxworkers")
	}
	if routingOption == routingOptionDelegatedKwd && cfg.Provide.Enabled.WithDefault(config.DefaultProvideEnabled) {
		return errors.New("Routing.Type=delegated does not support content providing. Set Provide.Enabled=false in your config")
	}

	return nil
}

func validateDaemonEnvironment() error {
	if flag := os.Getenv("IPFS_REUSEPORT"); flag != "" {
		return errors.New("support for IPFS_REUSEPORT was removed. Use LIBP2P_TCP_REUSEPORT instead")
	}
	return nil
}

// printLibp2pPorts prints which ports are opened to facilitate swarm connectivity.
func printLibp2pPorts(node *core.IpfsNode) {
	if !node.IsOnline {
		fmt.Println("Swarm not listening, running in offline mode.")
		return
	}

	if node.PeerHost == nil {
		log.Error("PeerHost is nil - this should not happen and likely indicates an FX dependency injection issue or race condition")
		fmt.Println("Swarm not properly initialized - node PeerHost is nil.")
		return
	}

	ifaceAddrs, err := node.PeerHost.Network().InterfaceListenAddresses()

View on GitHub (pinned to 329838acdf)

Solutions

  1. Rename the variable to LIBP2P_TCP_REUSEPORT in the environment (systemd unit, Dockerfile ENV, compose environment)
  2. Unset it for the current shell: `unset IPFS_REUSEPORT` before starting the daemon
  3. Search deployment configs for IPFS_REUSEPORT and remove all occurrences
  4. See docs/environment-variables.md for the supported variable set

Example fix

// before (systemd unit)
Environment=IPFS_REUSEPORT=false

// after
Environment=LIBP2P_TCP_REUSEPORT=false
Defensive patterns

Strategy: validation

Validate before calling

// fail before daemon start if removed env var is set
[ -n "${IPFS_REUSEPORT:-}" ] && echo "IPFS_REUSEPORT removed; use LIBP2P_TCP_REUSEPORT" && exit 1

Try / catch

if err := daemonFunc(...); err != nil {
    if strings.Contains(err.Error(), "IPFS_REUSEPORT was removed") {
        log.Fatalf("rename env var: %v", err)
    }
}

Prevention

When it happens

Trigger: `ipfs daemon` run with IPFS_REUSEPORT present in the environment — set in shell profiles, systemd units, Dockerfiles, or compose files from older Kubo versions.

Common situations: Container images inheriting env vars from legacy base images; operators upgrading Kubo while keeping old systemd/docker environment blocks.

Related errors


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