{"record":{"id":"92985c1fc27ba02a","repo":"hashicorp/nomad","slug":"invalid-range-s-s-w","errorCode":null,"errorMessage":"invalid range %s \"%s\": %w","messagePattern":"invalid range (.+?) \"(.+?)\": %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/shared/validators/validators.go","lineNumber":114,"sourceCode":"\n\treturn nil\n}\n\n// validateIDRange is used to ensure that the configuration for ID ranges is valid\n// by checking the syntax and bounds.\nfunc validateIDRange(rangeType string, deniedRanges string) error {\n\n\tparts := strings.Split(deniedRanges, \",\")\n\n\t// exit early if empty string\n\tif len(parts) == 1 && parts[0] == \"\" {\n\t\treturn nil\n\t}\n\n\tfor _, rangeStr := range parts {\n\t\terr := validateBounds(rangeStr)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid range %s \\\"%s\\\": %w\", rangeType, rangeStr, err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc validateBounds(boundsString string) error {\n\tuidDenyRangeParts := strings.Split(boundsString, \"-\")\n\n\tswitch len(uidDenyRangeParts) {\n\tcase 1:\n\t\tdisallowedIdStr := uidDenyRangeParts[0]\n\t\tif _, err := strconv.ParseUint(disallowedIdStr, 10, 32); err != nil {\n\t\t\treturn ErrInvalidBound\n\t\t}\n\n\tcase 2:\n\t\tlowerBoundStr := uidDenyRangeParts[0]","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/shared/validators/validators.go#L96-L132","documentation":"This error is returned by validateIDRange when a single element of the deniedHostUIDs or deniedHostGIDs configuration string fails syntax/bounds validation. Each comma-separated element must be either a single unsigned 32-bit integer or a 'lower-upper' range with lower <= upper; validateBounds returns ErrInvalidBound (not parseable as uint32) or ErrInvalidRange (lower > upper), and this wrapper names the offending config key and element. NewValidator therefore refuses to construct a Validator with malformed ID ranges.","triggerScenarios":"Calling NewValidator with deniedHostUIDs or deniedHostGIDs containing an element like 'abc', '5000-1000' (lower > upper), '1-2-3' (only first two parts checked, but '1-' fails parse), a number > 4294967295, or stray whitespace/negative values like '-5' or ' 100'.","commonSituations":"Typo'd Nomad client config blocks (client.options or similar deny-list settings), templated config injecting an empty or malformed range value, migrating configs where ranges were hand-edited, or operators writing reversed ranges like 65535-1024.","solutions":["Fix the offending element in the deniedHostUIDs/deniedHostGIDs config value named in the error so each element is 'N' or 'low-high' with low <= high and values within uint32 range","Remove surrounding whitespace or stray characters (commas already split elements, so '100, ' yields an empty-ish element that will fail)","If you only want single IDs denied, use comma-separated plain integers instead of ranges","Validate the range string manually before passing it to NewValidator"],"exampleFix":"// before\nv, err := validators.NewValidator(logger, \"0-99, 1000\", \"5000-1000\")\n// after\nv, err := validators.NewValidator(logger, \"0-99,1000\", \"1000-5000\")","handlingStrategy":"validation","validationCode":"func validRange(s string) bool {\n\tif s == \"\" { return true }\n\tfor _, part := range strings.Split(s, \",\") {\n\t\tb := strings.Split(part, \"-\")\n\t\tif len(b) == 1 {\n\t\t\tif _, err := strconv.ParseUint(b[0], 10, 32); err != nil { return false }\n\t\t} else if len(b) == 2 {\n\t\t\tlo, err1 := strconv.ParseUint(b[0], 10, 32)\n\t\t\thi, err2 := strconv.ParseUint(b[1], 10, 32)\n\t\t\tif err1 != nil || err2 != nil || lo > hi { return false }\n\t\t} else { return false }\n\t}\n\treturn true\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep deniedHostUIDs/deniedHostGIDs values as pure 'N' or 'low-high' elements with no spaces","Always order ranges ascending (low before high)","Validate config at load time with a unit test using NewValidator","Avoid generating range strings by string concatenation of possibly-empty values"],"tags":["config-validation","nomad","parsing"],"backgroundTag":"schema-validation-failed","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}