{"record":{"id":"46f6d0c7d8cddeb4","repo":"hashicorp/nomad","slug":"errinvalidbound","errorCode":"ErrInvalidBound","errorMessage":"range bound not valid","messagePattern":"range bound not valid","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/shared/validators/validators.go","lineNumber":18,"sourceCode":"// Copyright IBM Corp. 2015, 2026\n// SPDX-License-Identifier: MPL-2.0\n\npackage validators\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/hashicorp/go-hclog\"\n\t\"github.com/hashicorp/nomad/client/lib/idset\"\n\t\"github.com/hashicorp/nomad/helper/users\"\n)\n\nvar (\n\tErrInvalidBound = errors.New(\"range bound not valid\")\n\t//ErrEmptyRange   = errors.New(\"range value cannot be empty\")\n\tErrInvalidRange = errors.New(\"lower bound cannot be greater than upper bound\")\n)\n\ntype (\n\n\t// A GroupID (GID) represents a unique numerical value assigned to each user group.\n\tGroupID uint64\n\n\t// A UserID represents a unique numerical value assigned to each user account.\n\tUserID uint64\n)\n\ntype Validator struct {\n\t// DeniedHostUids configures which host uids are disallowed\n\tdeniedUIDs *idset.Set[UserID]\n\n\t// DeniedHostGids configures which host gids are disallowed","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/shared/validators/validators.go#L1-L36","documentation":"ErrInvalidBound is returned by the validators package's validateBounds when a bound in a UID/GID range string cannot be parsed as a uint32. Range strings use the form \"low-high\" (or a deny-list), and each endpoint must be a decimal number; anything non-numeric makes the whole range specification invalid.","triggerScenarios":"Passing a bounds string like \"banana-10\" or \"10-banana\" to validateBounds (used for validating allowed/disallowed UID/GID ranges, e.g. in the exec driver's uid/gid range config); strconv.ParseUint fails on the non-numeric endpoint.","commonSituations":"Typo'd ranges in client config (allow_caps-style list confusion); templating errors injecting empty or placeholder values; copying ranges with units like \"1000-2000k\"; whitespace or invisible characters in the config value.","solutions":["Correct the bounds string so both endpoints are plain decimal integers, e.g. \"1000-2000\"","Check the client config for interpolated variables that expand to non-numeric values","Trim whitespace/quotes from the configured range value","Validate the range with a quick parse locally before deploying the client config"],"exampleFix":"// before\nbounds = \"banana-10\"\n// after\nbounds = \"1-10\"","handlingStrategy":"validation","validationCode":"func validBounds(s string) error {\n    parts := strings.Split(s, \"-\")\n    for _, p := range parts {\n        if _, err := strconv.ParseUint(strings.TrimSpace(p), 10, 32); err != nil {\n            return fmt.Errorf(\"bound %q is not a valid uint32: %w\", p, err)\n        }\n    }\n    return nil\n}","typeGuard":"func isNumericBound(s string) bool { _, err := strconv.ParseUint(s, 10, 32); return err == nil }","tryCatchPattern":"if err := validators.ValidateBounds(cfg.Bounds); err != nil {\n    if errors.Is(err, validators.ErrInvalidBound) {\n        return fmt.Errorf(\"range %q has a non-numeric bound: %w\", cfg.Bounds, err)\n    }\n    return err\n}","preventionTips":["Use plain decimal integers for both range endpoints","Check templated values resolve to numbers before deploy","Trim whitespace and stray quotes from range config values"],"tags":["validation","uid-gid","ranges","nomad"],"backgroundTag":"invalid-numeric-range","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"}