hashicorp/nomad · error
description longer than %d
Error message
description longer than %d
What it means
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.
Source
Thrown at nomad/structs/structs.go:5663
// Denied specifies the node pools that are not allowed to be used by jobs
// in this namespace. This field supports wildcard globbing through the use
// of `*` for multi-character matching. If specified, any node pool is
// allowed to be used, except for those that match any of these patterns.
// This field cannot be used with Allowed.
Denied []string
}
func (n *Namespace) Validate() error {
var mErr multierror.Error
// Validate the name and description
if !validNamespaceName.MatchString(n.Name) {
err := fmt.Errorf("invalid name %q. Must match regex %s", n.Name, validNamespaceName)
mErr.Errors = append(mErr.Errors, err)
}
if len(n.Description) > maxNamespaceDescriptionLength {
err := fmt.Errorf("description longer than %d", maxNamespaceDescriptionLength)
mErr.Errors = append(mErr.Errors, err)
}
err := n.NodePoolConfiguration.Validate()
switch e := err.(type) {
case *multierror.Error:
for _, npErr := range e.Errors {
mErr.Errors = append(mErr.Errors, fmt.Errorf("invalid node pool configuration: %v", npErr))
}
case error:
mErr.Errors = append(mErr.Errors, fmt.Errorf("invalid node pool configuration: %v", e))
}
err = n.VaultConfiguration.Validate()
switch e := err.(type) {
case *multierror.Error:
for _, vErr := range e.Errors {
mErr.Errors = append(mErr.Errors, fmt.Errorf("invalid vault configuration: %v", vErr))View on GitHub (pinned to 482b49bf1a)
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
Example fix
// before
ns := &structs.Namespace{Description: strings.Repeat("x", 300)}
// after
desc := longDoc
if len(desc) > 256 { desc = desc[:256] }
ns := &structs.Namespace{Description: desc} Defensive patterns
Strategy: validation
Validate before calling
const maxNamespaceDescriptionLength = 256
if len(desc) > maxNamespaceDescriptionLength {
return fmt.Errorf("description is %d chars; limit is %d", len(desc), maxNamespaceDescriptionLength)
} Prevention
- 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
When it happens
Trigger: Submitting a Namespace via `nomad namespace apply -description ...`, the /v1/namespaces HTTP API, or structs.Namespace.Validate where len(Description) > 256.
Common situations: Using long free-form documentation or markdown in the namespace description field; automated tooling that stuffs metadata into descriptions.
Related errors
- volume validation failed: no such namespace %q
- mismatched request namespace in request: %q, %q
- must specify at least one namespace
- Invalid namespace %q: %v
- namespace %q using non-existent quota %q
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/6ba91d78730847d6.
Report an issue: GitHub.