{"record":{"id":"9760372eb559a420","repo":"hashicorp/nomad","slug":"transparent-proxy-block-has-invalid-uid-field-w","errorCode":null,"errorMessage":"transparent proxy block has invalid UID field: %w","messagePattern":"transparent proxy block has invalid UID field: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/connect.go","lineNumber":144,"sourceCode":"\t\t}\n\t}\n\n\trequireUIDisUint := func(uidRaw string) error {\n\t\t_, err := strconv.ParseUint(uidRaw, 10, 16)\n\t\tif err != nil {\n\t\t\te, ok := err.(*strconv.NumError)\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"invalid user ID %q: %w\", uidRaw, err)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"invalid user ID %q: %w\", uidRaw, e.Err)\n\t\t}\n\t\treturn nil\n\t}\n\n\tif tp.UID != \"\" {\n\t\tif err := requireUIDisUint(tp.UID); err != nil {\n\t\t\tmErr.Errors = append(mErr.Errors,\n\t\t\t\tfmt.Errorf(\"transparent proxy block has invalid UID field: %w\", err))\n\t\t}\n\t}\n\tfor _, uid := range tp.ExcludeUIDs {\n\t\tif err := requireUIDisUint(uid); err != nil {\n\t\t\tmErr.Errors = append(mErr.Errors,\n\t\t\t\tfmt.Errorf(\"transparent proxy block has invalid ExcludeUIDs field: %w\", err))\n\t\t}\n\t}\n\n\t// note: ExcludeInboundPorts are validated in connect validation hook\n\t// because we need information from the network block\n\n\tif mErr.Len() == 1 {\n\t\treturn mErr.Errors[0]\n\t}\n\treturn mErr.ErrorOrNil()\n}\n","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/connect.go#L126-L162","documentation":"If requireUIDisUint rejects the transparent_proxy block's uid, Validate collects 'transparent proxy block has invalid UID field' into the multi-error. It's the outer wrapper that points at the specific field, with the strconv reason nested via %w.","triggerScenarios":"Job/consul connect validation runs with transparent_proxy.uid set to a value that fails ParseUint(_, 10, 16), e.g. non-numeric or out-of-range strings.","commonSituations":"Authoring jobspecs by hand with a username instead of a numeric UID; template variables left unrendered (e.g. '{{ user }}') in the uid field.","solutions":["Replace the uid value with a numeric 0-65535 string","If using templating, ensure the variable renders to a number before submission","Read the nested %w error to see the exact strconv failure"],"exampleFix":"// before\ntransparent_proxy {\n  uid = \"{{ taskUser }}\"\n}\n// after\ntransparent_proxy {\n  uid = \"59999\"\n}","handlingStrategy":"validation","validationCode":"if tp.UID != \"\" {\n    if _, err := strconv.ParseUint(tp.UID, 10, 16); err != nil {\n        return fmt.Errorf(\"transparent_proxy.uid must be numeric 0-65535, got %q\", tp.UID)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := job.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"invalid UID field\") {\n        return fmt.Errorf(\"fix transparent_proxy.uid to a numeric UID: %w\", err)\n    }\n    return err\n}","preventionTips":["Render all template variables before submitting jobspecs","Add CI linting that checks transparent_proxy.uid matches ^[0-9]{1,5}$ and <= 65535","Document numeric-UID requirement for connect blocks in team runbooks"],"tags":["validation","connect","transparent-proxy"],"backgroundTag":"invalid-uid-value","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"}