{"record":{"id":"f8c8b227580e33d6","repo":"hashicorp/nomad","slug":"missing-path","errorCode":null,"errorMessage":"missing path","messagePattern":"missing path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/variables.go","lineNumber":71,"sourceCode":"\tmaxVariableSize = 65536\n\n\t// minVariableLockTTL and maxVariableLockTTL determine the range of valid durations for the\n\t// TTL on a lock.They come from the experience on Consul.\n\tminVariableLockTTL = 10 * time.Second\n\tmaxVariableLockTTL = 24 * time.Hour\n\n\t// defaultLockTTL is the default value used to maintain a lock before it needs to\n\t// be renewed. The actual value comes from the experience with Consul.\n\tdefaultLockTTL = 15 * time.Second\n\n\t// defaultLockDelay is the default a lock will be blocked after the TTL\n\t// went by without any renews. It is intended to prevent split brain situations.\n\t// The actual value comes from the experience with Consul.\n\tdefaultLockDelay = 15 * time.Second\n)\n\nvar (\n\terrNoPath             = errors.New(\"missing path\")\n\terrNoNamespace        = errors.New(\"missing namespace\")\n\terrNoLock             = errors.New(\"missing lock ID\")\n\terrWildCardNamespace  = errors.New(\"can not target wildcard (\\\"*\\\")namespace\")\n\terrQuotaExhausted     = errors.New(\"variables are limited to 64KiB in total size\")\n\terrNegativeDelayOrTTL = errors.New(\"Lock delay and TTL must be positive\")\n\terrInvalidTTL         = errors.New(\"TTL must be between 10 seconds and 24 hours\")\n)\n\n// VariableMetadata is the metadata envelope for a Variable, it is the list\n// object and is shared data between an VariableEncrypted and a\n// VariableDecrypted object.\ntype VariableMetadata struct {\n\tNamespace string\n\tPath      string\n\n\t// Lock represents a variable which is used for locking functionality.\n\tLock *VariableLock `json:\",omitempty\"`\n","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/variables.go#L53-L89","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nnomad var put '' key=value\n// after\nnomad var put 'nomad/jobs/myapp' key=value","handlingStrategy":"validation","validationCode":"if v.Path == \"\" {\n\treturn errors.New(\"variable path is required, e.g. nomad/jobs/myapp\")\n}","typeGuard":"func hasVarPath(v *structs.Variable) bool { return v != nil && v.Path != \"\" }","tryCatchPattern":"var mErr *multierror.Error\nif errors.As(err, &mErr) {\n\tfor _, e := range mErr.Errors {\n\t\tif errors.Is(e, structs.ErrNoPath) { /* set path and retry */ }\n\t}\n}","preventionTips":["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"],"tags":["nomad","variables","validation"],"backgroundTag":"missing-required-argument","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"}