{"record":{"id":"7994cc0034018126","repo":"ipfs/kubo","slug":"incorrectly-formatted-address-filter-in-config-s","errorCode":null,"errorMessage":"incorrectly formatted address filter in config: %s","messagePattern":"incorrectly formatted address filter in config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/node/libp2p/addrs.go","lineNumber":33,"sourceCode":"\t\"github.com/libp2p/go-libp2p/core/event\"\n\t\"github.com/libp2p/go-libp2p/core/host\"\n\tp2pbhost \"github.com/libp2p/go-libp2p/p2p/host/basic\"\n\tma \"github.com/multiformats/go-multiaddr\"\n\tmanet \"github.com/multiformats/go-multiaddr/net\"\n\tmamask \"github.com/whyrusleeping/multiaddr-filter\"\n\n\t\"github.com/caddyserver/certmagic\"\n\t\"go.uber.org/fx\"\n)\n\nfunc AddrFilters(filters []string) func() (*ma.Filters, Libp2pOpts, error) {\n\treturn func() (filter *ma.Filters, opts Libp2pOpts, err error) {\n\t\tfilter = ma.NewFilters()\n\t\topts.Opts = append(opts.Opts, libp2p.ConnectionGater((*filtersConnectionGater)(filter)))\n\t\tfor _, s := range filters {\n\t\t\tf, err := mamask.NewMask(s)\n\t\t\tif err != nil {\n\t\t\t\treturn filter, opts, fmt.Errorf(\"incorrectly formatted address filter in config: %s\", s)\n\t\t\t}\n\t\t\tfilter.AddFilter(*f, ma.ActionDeny)\n\t\t}\n\t\treturn filter, opts, nil\n\t}\n}\n\n// Sources for deadListenerFinding.Source.\nconst (\n\tdeadListenerSourceAddrFilters = \"Swarm.AddrFilters\"\n\tdeadListenerSourceNoAnnounce  = \"Addresses.NoAnnounce\"\n)\n\n// deadListenerFinding is one resolved listener whose IP falls inside a\n// CIDR in `Swarm.AddrFilters` (gater RSTs inbound) or\n// `Addresses.NoAnnounce` (listener never advertised).\ntype deadListenerFinding struct {\n\tListener string // resolved listen multiaddr (interface-bound)","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/node/libp2p/addrs.go#L15-L51","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before (config.json)\n\"Swarm\": { \"AddrFilters\": [\"10.0.0.0/8\"] }\n// after\n\"Swarm\": { \"AddrFilters\": [\"/ip4/10.0.0.0/ipcidr/8\"] }","handlingStrategy":"validation","validationCode":"for _, s := range cfg.Swarm.AddrFilters {\n    if _, err := mamask.NewMask(s); err != nil {\n        return fmt.Errorf(\"invalid Swarm.AddrFilters entry %q: %w\", s, err)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["libp2p","config","multiaddr"],"backgroundTag":"invalid-multiaddr-config","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}