hashicorp/nomad · error
missing path
Error message
missing path
What it means
errNoPath is the sentinel error "missing path" used by Variable (and VariableDecrypted) validation in Nomad's structs package. Variables are addressed by a path within a namespace, so a Variable with an empty Path cannot be stored or fetched and fails validation when the path check at variables.go:687 runs.
Source
Thrown at nomad/structs/variables.go:71
maxVariableSize = 65536
// minVariableLockTTL and maxVariableLockTTL determine the range of valid durations for the
// TTL on a lock.They come from the experience on Consul.
minVariableLockTTL = 10 * time.Second
maxVariableLockTTL = 24 * time.Hour
// defaultLockTTL is the default value used to maintain a lock before it needs to
// be renewed. The actual value comes from the experience with Consul.
defaultLockTTL = 15 * time.Second
// defaultLockDelay is the default a lock will be blocked after the TTL
// went by without any renews. It is intended to prevent split brain situations.
// The actual value comes from the experience with Consul.
defaultLockDelay = 15 * time.Second
)
var (
errNoPath = errors.New("missing path")
errNoNamespace = errors.New("missing namespace")
errNoLock = errors.New("missing lock ID")
errWildCardNamespace = errors.New("can not target wildcard (\"*\")namespace")
errQuotaExhausted = errors.New("variables are limited to 64KiB in total size")
errNegativeDelayOrTTL = errors.New("Lock delay and TTL must be positive")
errInvalidTTL = errors.New("TTL must be between 10 seconds and 24 hours")
)
// VariableMetadata is the metadata envelope for a Variable, it is the list
// object and is shared data between an VariableEncrypted and a
// VariableDecrypted object.
type VariableMetadata struct {
Namespace string
Path string
// Lock represents a variable which is used for locking functionality.
Lock *VariableLock `json:",omitempty"`
View on GitHub (pinned to 482b49bf1a)
Solutions
- Provide a non-empty path argument to nomad var put or set the Path field in the API payload, e.g. "nomad/jobs/myjob".
- In API clients, default the path from the resource being addressed before calling Validate.
- Check upstream interpolation: if the path comes from a template variable, ensure it resolves to a non-empty string.
Example fix
// before nomad var put '' key=value // after nomad var put 'nomad/jobs/myapp' key=value
Defensive patterns
Strategy: validation
Validate before calling
if v.Path == "" {
return errors.New("variable path is required, e.g. nomad/jobs/myapp")
} Type guard
func hasVarPath(v *structs.Variable) bool { return v != nil && v.Path != "" } Try / catch
var mErr *multierror.Error
if errors.As(err, &mErr) {
for _, e := range mErr.Errors {
if errors.Is(e, structs.ErrNoPath) { /* set path and retry */ }
}
} Prevention
- Pass the path explicitly to `nomad var put`
- Default the path in API client wrappers before validation
- Verify template interpolation yields a non-empty path
When it happens
Trigger: Submitting a variable via POST /v1/var (nomad var put) with an empty or absent path; calling Variable.Validate / canonicalizeAndValidate on a struct where v.Path == ""; creating a lock variable without a path.
Common situations: CLI invocations like `nomad var put` missing the <path> argument; API clients building JSON payloads that omit the path key; templates rendering empty path from interpolation; tests exercising RenewLockRequest validation.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- missing namespace
- missing lock ID
- can not target wildcard ("*")namespace
- variables are limited to 64KiB in total size
- Lock delay and TTL must be positive
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/f8c8b227580e33d6.
Report an issue: GitHub.