ipfs/kubo · error

invalid bootstrap address: %s

Error message

invalid bootstrap address: %s

What it means

`bootstrapAdd` validates each peer string as a multiaddr whose last component is the `/p2p/<peerID>` protocol. `ma.SplitLast(m)` returns the transport part and the p2p part; if the p2p part is missing or is not P_P2P, the address is rejected with `invalid bootstrap address: %s`. The string parsed as a multiaddr but does not identify a peer.

Source

Thrown at core/commands/bootstrap.go:281

			return err
		}
	}
	return nil
}

func bootstrapAdd(r repo.Repo, cfg *config.Config, peers []string) ([]string, error) {
	// Validate peers - skip validation for "auto" placeholder
	for _, p := range peers {
		if p == config.AutoPlaceholder {
			continue // Skip validation for "auto" placeholder
		}
		m, err := ma.NewMultiaddr(p)
		if err != nil {
			return nil, err
		}
		tpt, p2ppart := ma.SplitLast(m)
		if p2ppart == nil || p2ppart.Protocol().Code != ma.P_P2P {
			return nil, fmt.Errorf("invalid bootstrap address: %s", p)
		}
		if tpt == nil {
			return nil, fmt.Errorf("bootstrap address without a transport: %s", p)
		}
	}

	addedMap := map[string]struct{}{}
	addedList := make([]string, 0, len(peers))

	// re-add cfg bootstrap peers to rm dupes
	bpeers := cfg.Bootstrap
	cfg.Bootstrap = nil

	// add new peers
	for _, s := range peers {
		if _, found := addedMap[s]; found {
			continue
		}

View on GitHub (pinned to 329838acdf)

Solutions

  1. Append the peer ID: `/ip4/1.2.3.4/tcp/4001/p2p/<peerID>` (or `/dnsaddr/.../p2p/<peerID>`)
  2. Get the full address from the remote node with `ipfs id` (Addresses field)
  3. Validate locally with ma.NewMultiaddr + SplitLast before scripting the add

Example fix

// before
ipfs bootstrap add /ip4/104.131.131.82/tcp/4001
// after
ipfs bootstrap add /ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
Defensive patterns

Strategy: validation

Validate before calling

func validBootstrapAddr(p string) bool {
    m, err := ma.NewMultiaddr(p)
    if err != nil { return false }
    _, last := ma.SplitLast(m)
    return last != nil && last.Protocol().Code == ma.P_P2P
}

Type guard

null

Try / catch

if err != nil && strings.HasPrefix(err.Error(), "invalid bootstrap address:") {
    // fix the multiaddr: append /p2p/<peerID>
}

Prevention

When it happens

Trigger: `ipfs bootstrap add` with an address lacking a `/p2p/<peerID>` suffix, e.g. `/ip4/1.2.3.4/tcp/4001`, a malformed peer ID after /p2p/, or a bare peer ID string.

Common situations: Copying transport-only addresses from server configs; truncated multiaddrs in shell scripts; misspelled legacy `/ipfs/` suffix; DNS addresses missing the peer ID component.

Related errors


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