{"record":{"id":"6ba91d78730847d6","repo":"hashicorp/nomad","slug":"description-longer-than-d-6ba91d","errorCode":null,"errorMessage":"description longer than %d","messagePattern":"description longer than (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":5663,"sourceCode":"\n\t// Denied specifies the node pools that are not allowed to be used by jobs\n\t// in this namespace. This field supports wildcard globbing through the use\n\t// of `*` for multi-character matching. If specified, any node pool is\n\t// allowed to be used, except for those that match any of these patterns.\n\t// This field cannot be used with Allowed.\n\tDenied []string\n}\n\nfunc (n *Namespace) Validate() error {\n\tvar mErr multierror.Error\n\n\t// Validate the name and description\n\tif !validNamespaceName.MatchString(n.Name) {\n\t\terr := fmt.Errorf(\"invalid name %q. Must match regex %s\", n.Name, validNamespaceName)\n\t\tmErr.Errors = append(mErr.Errors, err)\n\t}\n\tif len(n.Description) > maxNamespaceDescriptionLength {\n\t\terr := fmt.Errorf(\"description longer than %d\", maxNamespaceDescriptionLength)\n\t\tmErr.Errors = append(mErr.Errors, err)\n\t}\n\n\terr := n.NodePoolConfiguration.Validate()\n\tswitch e := err.(type) {\n\tcase *multierror.Error:\n\t\tfor _, npErr := range e.Errors {\n\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"invalid node pool configuration: %v\", npErr))\n\t\t}\n\tcase error:\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"invalid node pool configuration: %v\", e))\n\t}\n\n\terr = n.VaultConfiguration.Validate()\n\tswitch e := err.(type) {\n\tcase *multierror.Error:\n\t\tfor _, vErr := range e.Errors {\n\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"invalid vault configuration: %v\", vErr))","sourceCodeStart":5645,"sourceCodeEnd":5681,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L5645-L5681","documentation":"Namespace.Validate() enforces a maximum description length of maxNamespaceDescriptionLength = 256 characters. A longer Description field causes this error to be appended to the multierror returned from namespace create/update.","triggerScenarios":"Submitting a Namespace via `nomad namespace apply -description ...`, the /v1/namespaces HTTP API, or structs.Namespace.Validate where len(Description) > 256.","commonSituations":"Using long free-form documentation or markdown in the namespace description field; automated tooling that stuffs metadata into descriptions.","solutions":["Shorten the description to 256 characters or fewer","Move long documentation into external docs or labels outside the namespace spec","Truncate the description programmatically before calling the API","Validate len(description) <= 256 in your IaC before apply"],"exampleFix":"// before\nns := &structs.Namespace{Description: strings.Repeat(\"x\", 300)}\n// after\ndesc := longDoc\nif len(desc) > 256 { desc = desc[:256] }\nns := &structs.Namespace{Description: desc}","handlingStrategy":"validation","validationCode":"const maxNamespaceDescriptionLength = 256\nif len(desc) > maxNamespaceDescriptionLength {\n    return fmt.Errorf(\"description is %d chars; limit is %d\", len(desc), maxNamespaceDescriptionLength)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Truncate descriptions at generation time (desc[:256])","Keep long docs in external systems, not the namespace spec","Add a CI schema check for field lengths","Watch for multi-byte runes if counting with len() on user text"],"tags":["nomad","validation","namespace"],"backgroundTag":"field-length-limit-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"}