{"record":{"id":"9cf43357fbcf4fcb","repo":"hashicorp/nomad","slug":"only-one-region-limit-block-allowed-per-limit","errorCode":null,"errorMessage":"only one 'region_limit' block allowed per limit","messagePattern":"only one 'region_limit' block allowed per limit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/quota_apply.go","lineNumber":255,"sourceCode":"\t\t\tif err := parseQuotaResource(limit.RegionLimit, o); err != nil {\n\t\t\t\treturn multierror.Prefix(err, \"region_limit ->\")\n\t\t\t}\n\t\t}\n\n\t\t*result = append(*result, &limit)\n\t}\n\n\treturn nil\n}\n\n// parseQuotaResource parses the region_limit resources\nfunc parseQuotaResource(result *api.QuotaResources, list *ast.ObjectList) error {\n\tlist = list.Elem()\n\tif len(list.Items) == 0 {\n\t\treturn nil\n\t}\n\tif len(list.Items) > 1 {\n\t\treturn fmt.Errorf(\"only one 'region_limit' block allowed per limit\")\n\t}\n\n\t// Get our resource object\n\to := list.Items[0]\n\n\t// We need this later\n\tvar listVal *ast.ObjectList\n\tif ot, ok := o.Val.(*ast.ObjectType); ok {\n\t\tlistVal = ot.List\n\t} else {\n\t\treturn fmt.Errorf(\"resource: should be an object\")\n\t}\n\n\t// Check for invalid keys\n\tvalid := []string{\n\t\t\"cores\",\n\t\t\"cpu\",\n\t\t\"memory\",","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/quota_apply.go#L237-L273","documentation":"Returned by parseQuotaResource while parsing an HCL quota limit: more than one region_limit block appeared inside a single limit, but the schema allows at most one.","triggerScenarios":"Declaring `region_limit` twice inside a single `limit` block in the quota HCL file.","commonSituations":"Merging quota files or copy-pasting limits where a second region_limit block was left behind; combining region-specific limits into one block instead of separate limit blocks.","solutions":["Keep only one region_limit per limit block; delete the duplicate.","If you need different resource caps per region, use separate `limit` blocks, each with its own region and region_limit.","Run `nomad quota apply -parse-only` to validate before applying."],"exampleFix":"// before\nlimit {\n  region = \"global\"\n  region_limit { cpu = 100 }\n  region_limit { memory_mb = 512 }\n}\n\n// after\nlimit {\n  region = \"global\"\n  region_limit { cpu = 100 memory_mb = 512 }\n}","handlingStrategy":"validation","validationCode":"const count = (hclBlock.match(/region_limit\\s*\\{/g) || []).length;\nif (count > 1) throw new Error('only one region_limit allowed per limit block; split into separate limit blocks');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["One region_limit per limit block; merge resource keys into a single block.","Use separate limit blocks for per-region caps.","Add a lint check counting region_limit occurrences per limit."],"tags":["hcl","quota","duplicate-key","nomad"],"backgroundTag":"duplicate-config-block","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"}