{"record":{"id":"e84215d3e8ffec8a","repo":"docker/compose","slug":"invalid-ip-range-w","errorCode":null,"errorMessage":"invalid ip-range: %w","messagePattern":"invalid ip-range: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/create.go","lineNumber":1538,"sourceCode":"\nfunc parseIPAMPool(pool *types.IPAMPool) (network.IPAMConfig, error) {\n\tvar (\n\t\terr        error\n\t\tsubNet     netip.Prefix\n\t\tipRange    netip.Prefix\n\t\tgateway    netip.Addr\n\t\tauxAddress map[string]netip.Addr\n\t)\n\tif pool.Subnet != \"\" {\n\t\tsubNet, err = netip.ParsePrefix(pool.Subnet)\n\t\tif err != nil {\n\t\t\treturn network.IPAMConfig{}, fmt.Errorf(\"invalid subnet: %w\", err)\n\t\t}\n\t}\n\tif pool.IPRange != \"\" {\n\t\tipRange, err = netip.ParsePrefix(pool.IPRange)\n\t\tif err != nil {\n\t\t\treturn network.IPAMConfig{}, fmt.Errorf(\"invalid ip-range: %w\", err)\n\t\t}\n\t}\n\tif pool.Gateway != \"\" {\n\t\tgateway, err = netip.ParseAddr(pool.Gateway)\n\t\tif err != nil {\n\t\t\treturn network.IPAMConfig{}, fmt.Errorf(\"invalid gateway address: %w\", err)\n\t\t}\n\t}\n\tif len(pool.AuxiliaryAddresses) > 0 {\n\t\tauxAddress = make(map[string]netip.Addr, len(pool.AuxiliaryAddresses))\n\t\tfor auxName, addr := range pool.AuxiliaryAddresses {\n\t\t\tauxAddr, err := netip.ParseAddr(addr)\n\t\t\tif err != nil {\n\t\t\t\treturn network.IPAMConfig{}, fmt.Errorf(\"invalid auxiliary address: %w\", err)\n\t\t\t}\n\t\t\tauxAddress[auxName] = auxAddr\n\t\t}\n","sourceCodeStart":1520,"sourceCodeEnd":1556,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/create.go#L1520-L1556","documentation":"The IPAM pool 'ip_range' (compose: ip_range/iprang) failed netip.ParsePrefix during parseIPAMPool. Docker expects a CIDR range, not a dash range or bare address.","triggerScenarios":"ipam: {config: [{subnet: 172.16.0.0/16, ip_range: 172.16.0.0/24}]} with any non-CIDR value, e.g. '172.16.0.5' (no prefix) or '172.16.0.1-172.16.0.10'.","commonSituations":"Porting dash-notation ranges from other tools or older configs; expecting ip_range to accept a single IP; host-bit-set ranges.","solutions":["Express the range as CIDR: 172.16.0.0/24","For a single reserved-ish IP use a /32 (IPv4) or /128 (IPv6)","Ensure the range is inside the subnet and aligned to a network boundary"],"exampleFix":"# before\nip_range: 172.16.0.1-172.16.0.10\n# after\nip_range: 172.16.0.0/28","handlingStrategy":"validation","validationCode":"if pool.IPRange != \"\" {\n    r, err := netip.ParsePrefix(pool.IPRange)\n    if err != nil { return fmt.Errorf(\"fix ip_range %q: %w\", pool.IPRange, err) }\n    if s, _ := netip.ParsePrefix(pool.Subnet); s.Bits() > 0 && !s.Contains(r.Addr()) {\n        return fmt.Errorf(\"ip_range %s outside subnet %s\", r, s)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use CIDR notation for ranges","Compute ranges with IP math libraries rather than string formatting"],"tags":["network","ipam","validation","cidr"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}