{"record":{"id":"7cd03f25aa3ed9b4","repo":"hashicorp/nomad","slug":"description-longer-than-d","errorCode":null,"errorMessage":"description longer than %d","messagePattern":"description longer than (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/acl.go","lineNumber":379,"sourceCode":"\t\tJobACL:      a.JobACL,\n\t\tHash:        a.Hash,\n\t\tCreateIndex: a.CreateIndex,\n\t\tModifyIndex: a.ModifyIndex,\n\t}\n}\n\nfunc (a *ACLPolicy) Validate() error {\n\tvar mErr multierror.Error\n\tif !ValidPolicyName.MatchString(a.Name) {\n\t\terr := fmt.Errorf(\"invalid name '%s'\", a.Name)\n\t\tmErr.Errors = append(mErr.Errors, err)\n\t}\n\tif _, err := acl.Parse(a.Rules, acl.PolicyParseStrict); err != nil {\n\t\terr = fmt.Errorf(\"failed to parse rules: %v\", err)\n\t\tmErr.Errors = append(mErr.Errors, err)\n\t}\n\tif len(a.Description) > maxPolicyDescriptionLength {\n\t\terr := fmt.Errorf(\"description longer than %d\", maxPolicyDescriptionLength)\n\t\tmErr.Errors = append(mErr.Errors, err)\n\t}\n\tif a.JobACL != nil {\n\t\tif a.JobACL.JobID != \"\" && a.JobACL.Namespace == \"\" {\n\t\t\terr := fmt.Errorf(\"namespace must be set to set job ID\")\n\t\t\tmErr.Errors = append(mErr.Errors, err)\n\t\t}\n\t\tif a.JobACL.Group != \"\" && a.JobACL.JobID == \"\" {\n\t\t\terr := fmt.Errorf(\"job ID must be set to set group\")\n\t\t\tmErr.Errors = append(mErr.Errors, err)\n\t\t}\n\t\tif a.JobACL.Task != \"\" && a.JobACL.Group == \"\" {\n\t\t\terr := fmt.Errorf(\"group must be set to set task\")\n\t\t\tmErr.Errors = append(mErr.Errors, err)\n\t\t}\n\t}\n\n\treturn mErr.ErrorOrNil()","sourceCodeStart":361,"sourceCodeEnd":397,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/acl.go#L361-L397","documentation":"ACLPolicy.Validate enforces a maximum length on the policy Description field (maxPolicyDescriptionLength) and appends 'description longer than %d' when exceeded. Descriptions are stored metadata displayed in listings, so Nomad caps them to keep API responses and state store entries compact.","triggerScenarios":"Submitting an ACL policy whose Description string exceeds maxPolicyDescriptionLength bytes — typically via `nomad acl policy apply -description ...` or the ACL policy API.","commonSituations":"Pasting a long explanatory paragraph or entire README note into the description field; scripted provisioning copying a commit message into the description; migrations from other systems (e.g. Consul policies) with longer description limits.","solutions":["Shorten the description to at most maxPolicyDescriptionLength characters and resubmit.","Move long documentation into version control next to the policy HCL instead of the description field.","If scripted, truncate programmatically (e.g. cut to the limit) before calling the API.","Check the constant maxPolicyDescriptionLength in structs/acl.go for the exact current limit."],"exampleFix":"// before\npolicy.Description = veryLongParagraph\n// after\nconst maxPolicyDescriptionLength = 256\nif len(veryLongParagraph) > maxPolicyDescriptionLength {\n    veryLongParagraph = veryLongParagraph[:maxPolicyDescriptionLength]\n}\npolicy.Description = veryLongParagraph","handlingStrategy":"validation","validationCode":"const maxPolicyDescriptionLength = 256\nfunc validateDescription(desc string) error {\n    if len(desc) > maxPolicyDescriptionLength {\n        return fmt.Errorf(\"description is %d bytes, max %d\", len(desc), maxPolicyDescriptionLength)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := policy.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"description longer than\") {\n        policy.Description = truncate(policy.Description, maxPolicyDescriptionLength)\n    }\n    return policy.Validate()\n}","preventionTips":["Truncate descriptions at write time in tooling.","Keep long documentation in the policy HCL repo, not the Description field.","Note the limit counts bytes, not runes, for non-ASCII text.","Check maxPolicyDescriptionLength in structs/acl.go for the current value."],"tags":["acl","validation","limits"],"backgroundTag":"field-length-exceeded","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"}