ipfs/kubo · error
incorrectly formatted address filter in config: %s
Error message
incorrectly formatted address filter in config: %s
What it means
When building the libp2p host, each entry of Swarm.AddrFilters is parsed as a CIDR-style address mask (via mamask.NewMask, e.g. "/ip4/10.0.0.0/ipcidr/24"). An entry that cannot be parsed aborts node construction with this error, naming the offending filter string.
Source
Thrown at core/node/libp2p/addrs.go:33
"github.com/libp2p/go-libp2p/core/event"
"github.com/libp2p/go-libp2p/core/host"
p2pbhost "github.com/libp2p/go-libp2p/p2p/host/basic"
ma "github.com/multiformats/go-multiaddr"
manet "github.com/multiformats/go-multiaddr/net"
mamask "github.com/whyrusleeping/multiaddr-filter"
"github.com/caddyserver/certmagic"
"go.uber.org/fx"
)
func AddrFilters(filters []string) func() (*ma.Filters, Libp2pOpts, error) {
return func() (filter *ma.Filters, opts Libp2pOpts, err error) {
filter = ma.NewFilters()
opts.Opts = append(opts.Opts, libp2p.ConnectionGater((*filtersConnectionGater)(filter)))
for _, s := range filters {
f, err := mamask.NewMask(s)
if err != nil {
return filter, opts, fmt.Errorf("incorrectly formatted address filter in config: %s", s)
}
filter.AddFilter(*f, ma.ActionDeny)
}
return filter, opts, nil
}
}
// Sources for deadListenerFinding.Source.
const (
deadListenerSourceAddrFilters = "Swarm.AddrFilters"
deadListenerSourceNoAnnounce = "Addresses.NoAnnounce"
)
// deadListenerFinding is one resolved listener whose IP falls inside a
// CIDR in `Swarm.AddrFilters` (gater RSTs inbound) or
// `Addresses.NoAnnounce` (listener never advertised).
type deadListenerFinding struct {
Listener string // resolved listen multiaddr (interface-bound)View on GitHub (pinned to 329838acdf)
Solutions
- Run `ipfs config Swarm.AddrFilters` and fix the offending entry to multiaddr mask form, e.g. "/ip4/192.168.0.0/ipcidr/16" or "/ip6/fc00::/ipcidr/7"
- Validate the multiaddr with `ipfs multiaddr /ip4/10.0.0.0/ipcidr/8` before writing it to config
- Remove stale/invalid entries entirely if you no longer need that filter
Example fix
// before (config.json)
"Swarm": { "AddrFilters": ["10.0.0.0/8"] }
// after
"Swarm": { "AddrFilters": ["/ip4/10.0.0.0/ipcidr/8"] } Defensive patterns
Strategy: validation
Validate before calling
for _, s := range cfg.Swarm.AddrFilters {
if _, err := mamask.NewMask(s); err != nil {
return fmt.Errorf("invalid Swarm.AddrFilters entry %q: %w", s, err)
}
} Prevention
- Write filters only in multiaddr mask form like /ip4/10.0.0.0/ipcidr/8, never plain CIDR
- Validate each entry with `ipfs multiaddr` or mamask.NewMask before saving config
- Remove filters copied from IPv4 examples when switching to IPv6 ranges
When it happens
Trigger: Starting the daemon with a Swarm.AddrFilters entry that is not a valid multiaddr mask — wrong multiaddr syntax, unsupported protocol, or typo — in the config.
Common situations: Copying filters from IPv4 examples for IPv6 (or vice versa); hand-written masks like "10.0.0.0/8" (plain CIDR, not multiaddr) instead of "/ip4/10.0.0.0/ipcidr/8"; leftover entries from very old kubo versions with outdated syntax.
Related errors
- serveHTTPApi: invalid API address: %q (err: %s)
- serveHTTPGateway: invalid gateway address: %q (err: %s)
- serveHTTPGateway: manet.ToNetAddr() failed: %w
- conn not found
- unrecognized Swarm.ConnMgr.Type: %q
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/7994cc0034018126.
Report an issue: GitHub.