hashicorp/nomad · error
variable requires path
Error message
variable requires path
What it means
ValidatePath found an empty variable path. Every Nomad variable is addressed by a path, so VariableData.Validate fails immediately before the regex check when path is the empty string.
Source
Thrown at nomad/structs/variables.go:415
if vd.Namespace == AllNamespacesSentinel {
mErr.Errors = append(mErr.Errors, errWildCardNamespace)
return &mErr
}
if vd.Items.Size() > maxVariableSize {
return errQuotaExhausted
}
if err := ValidatePath(vd.Path); err != nil {
return err
}
return vd.Lock.Validate()
}
func ValidatePath(path string) error {
if len(path) == 0 {
return fmt.Errorf("variable requires path")
}
if !validVariablePath.MatchString(path) {
return fmt.Errorf("invalid path %q", path)
}
parts := strings.Split(path, "/")
if parts[0] != "nomad" {
return nil
}
// Don't allow a variable with path "nomad"
if len(parts) == 1 {
return fmt.Errorf(`"nomad" is a reserved top-level directory path, but you may write variables to "nomad/jobs", "nomad/job-templates", "nomad/sentinel", or below`)
}
switch {
case parts[1] == "jobs" || parts[1] == "sentinel":View on GitHub (pinned to 482b49bf1a)
Solutions
- Supply a path such as "my/app/config" when creating or updating the variable
- Check the client SDK call is not dropping the path field
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at nomad/structs/variables.go:415 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/9b197b440ca13479.
Report an issue: GitHub.