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
- Append the peer ID: `/ip4/1.2.3.4/tcp/4001/p2p/<peerID>` (or `/dnsaddr/.../p2p/<peerID>`)
- Get the full address from the remote node with `ipfs id` (Addresses field)
- 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
- Always append /p2p/<peerID> to transport multiaddrs
- Copy addresses from `ipfs id` output, not hand-typed
- Validate with a multiaddr parser before scripting adds
- Beware truncated addresses in shell variables/wrapping
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
- bootstrap address without a transport: %s
- serveHTTPGateway: invalid gateway address: %q (err: %s)
- invalid configuration profile: %s
- unsupported API address: %s
- inline-limit %d exceeds maximum allowed size of %d bytes
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/12e96c55c11a219a.
Report an issue: GitHub.