{"record":{"id":"49f0dd1b9d09a331","repo":"hashicorp/nomad","slug":"variables-can-store-a-maximum-of-d-bytes-of-encry","errorCode":null,"errorMessage":"variables can store a maximum of %d bytes of encrypted data per namespace","messagePattern":"variables can store a maximum of (.+?) bytes of encrypted data per namespace","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/state/state_store_variables.go","lineNumber":268,"sourceCode":"\t}\n\n\t// Track quota usage\n\tvar quotaUsed *structs.VariablesQuota\n\tif existingQuota != nil {\n\t\tquotaUsed = existingQuota.(*structs.VariablesQuota)\n\t\tquotaUsed = quotaUsed.Copy()\n\t} else {\n\t\tquotaUsed = &structs.VariablesQuota{\n\t\t\tNamespace:   sv.Namespace,\n\t\t\tCreateIndex: idx,\n\t\t}\n\t}\n\n\tif quotaChange > math.MaxInt64-quotaUsed.Size {\n\t\t// this limit is actually shared across all namespaces in the region's\n\t\t// quota (if there is one), but we need this check here to prevent\n\t\t// overflow as well\n\t\treturn req.ErrorResponse(idx, fmt.Errorf(\"variables can store a maximum of %d bytes of encrypted data per namespace\", math.MaxInt))\n\t}\n\n\tif quotaChange > 0 {\n\t\tquotaUsed.Size += quotaChange\n\t} else if quotaChange < 0 {\n\t\tquotaUsed.Size -= min(quotaUsed.Size, -quotaChange)\n\t}\n\n\terr = s.enforceVariablesQuota(idx, tx, sv.Namespace, quotaChange)\n\tif err != nil {\n\t\treturn req.ErrorResponse(idx, err)\n\t}\n\n\t// we check enforcement above even if there's no change because another\n\t// namespace may have used up quota to make this no longer valid, but we\n\t// only update the table if this namespace has changed\n\tif quotaChange != 0 {\n\t\tquotaUsed.ModifyIndex = idx","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/state/state_store_variables.go#L250-L286","documentation":"Writing the variable would push the namespace's total encrypted variable storage past the configured quota (or overflow the size counter); varSetTxn enforces a per-namespace byte limit on encrypted variable data.","triggerScenarios":"Thrown at nomad/state/state_store_variables.go:268 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the size of variables in the namespace (delete or shrink entries)","Raise the variables quota in the namespace/region configuration","Split large data out of variables into an external store"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}