{"record":{"id":"08a25758a3dca40c","repo":"AdguardTeam/AdGuardHome","slug":"range-is-too-large","errorCode":null,"errorMessage":"range is too large","messagePattern":"range is too large","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/dhcpd/iprange.go","lineNumber":46,"sourceCode":"const maxRangeLen = math.MaxUint32\n\n// newIPRange creates a new IP address range.  start must be less than end.  The\n// resulting range must not be greater than maxRangeLen.\nfunc newIPRange(start, end net.IP) (r *ipRange, err error) {\n\tdefer func() { err = errors.Annotate(err, \"invalid ip range: %w\") }()\n\n\t// Make sure that both are 16 bytes long to simplify handling in\n\t// methods.\n\tstart, end = start.To16(), end.To16()\n\n\tstartInt := (&big.Int{}).SetBytes(start)\n\tendInt := (&big.Int{}).SetBytes(end)\n\tdiff := (&big.Int{}).Sub(endInt, startInt)\n\n\tif diff.Sign() <= 0 {\n\t\treturn nil, fmt.Errorf(\"start is greater than or equal to end\")\n\t} else if !diff.IsUint64() || diff.Uint64() > maxRangeLen {\n\t\treturn nil, fmt.Errorf(\"range is too large\")\n\t}\n\n\tr = &ipRange{\n\t\tstart: startInt,\n\t\tend:   endInt,\n\t}\n\n\treturn r, nil\n}\n\n// contains returns true if r contains ip.\nfunc (r *ipRange) contains(ip net.IP) (ok bool) {\n\tif r == nil {\n\t\treturn false\n\t}\n\n\tipInt := (&big.Int{}).SetBytes(ip.To16())\n","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/dhcpd/iprange.go#L28-L64","documentation":"Returned by newIPRange when end-start exceeds the allowed maximum (maxRangeLen) or the difference does not fit a uint64. This prevents absurd ranges like 0.0.0.0–255.255.255.255 that would exhaust memory or make no operational sense.","triggerScenarios":"Submitting a range spanning more than maxRangeLen addresses — classically range_start 0.0.0.0 with range_end 255.255.255.255, or a /8 subnet — or an IPv6 range whose low-bits difference exceeds the uint64 limit.","commonSituations":"Leaving range fields at their placeholder defaults; misunderstanding subnet size (a /16 gives 65k addresses but a /8 gives 16M); trying to 'cover everything' with 0.0.0.0–255.255.255.255.","solutions":["Narrow the range to your actual subnet, typically a small slice like 192.168.1.50–192.168.1.250","Confirm your subnet mask matches the range size (e.g. /24 supports at most ~253 usable addresses)","For DHCPv6, keep the range within the low 64 bits of a single /64 prefix"],"exampleFix":"// before\n\"range_start\":\"0.0.0.0\",\"range_end\":\"255.255.255.255\"\n// -> range is too large\n\n// after\n\"range_start\":\"192.168.1.50\",\"range_end\":\"192.168.1.250\"","handlingStrategy":"validation","validationCode":"func rangeSizeOK(start, end string) bool {\n\ts, e := net.ParseIP(start), net.ParseIP(end)\n\tif s == nil || e == nil { return false }\n\td := big.NewInt(0).Sub(bytesToBig(e.To16()), bytesToBig(s.To16()))\n\treturn d.IsUint64() && d.Uint64() <= maxRangeLen // 65536 in adguard's dhcpd\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Size ranges to the actual subnet (/24 → a few hundred addresses)","Never use 0.0.0.0–255.255.255.255 style 'catch-all' ranges","Compute the address count before submitting the config"],"tags":["dhcp","validation","ip-range","configuration"],"backgroundTag":"invalid-ip-range","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}