{"record":{"id":"6f6b8ff04461f1b5","repo":"hashicorp/nomad","slug":"missing-s","errorCode":null,"errorMessage":"missing %s","messagePattern":"missing (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/taskrunner/volume_hook.go","lineNumber":55,"sourceCode":"\nfunc validateHostVolumes(requestedByAlias map[string]*structs.VolumeRequest, clientVolumesByName map[string]*structs.ClientHostVolumeConfig, allocName string) error {\n\tvar result error\n\n\tfor _, req := range requestedByAlias {\n\t\t// This is a defensive check, but this function should only ever receive\n\t\t// host-type volumes.\n\t\tif req.Type != structs.VolumeTypeHost {\n\t\t\tcontinue\n\t\t}\n\n\t\tsource := req.Source\n\t\tif req.PerAlloc {\n\t\t\tsource = source + structs.AllocSuffix(allocName)\n\t\t}\n\n\t\t_, ok := clientVolumesByName[source]\n\t\tif !ok {\n\t\t\tresult = multierror.Append(result, fmt.Errorf(\"missing %s\", source))\n\t\t}\n\t}\n\n\treturn result\n}\n\n// hostVolumeMountConfigurations takes the users requested volume mounts,\n// volumes, and the client host volume configuration and converts them into a\n// format that can be used by drivers.\nfunc (h *volumeHook) hostVolumeMountConfigurations(taskMounts []*structs.VolumeMount, taskVolumesByAlias map[string]*structs.VolumeRequest, clientVolumesByName map[string]*structs.ClientHostVolumeConfig, allocName string) ([]*drivers.MountConfig, error) {\n\tvar mounts []*drivers.MountConfig\n\tfor _, m := range taskMounts {\n\t\treq, ok := taskVolumesByAlias[m.Volume]\n\t\tif !ok {\n\t\t\t// This function receives only the task volumes that are of type Host,\n\t\t\t// if we can't find a group volume then we assume the mount is for another\n\t\t\t// type.\n\t\t\tcontinue","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/taskrunner/volume_hook.go#L37-L73","documentation":"validateHostVolumes checks that every host volume requested by the allocation exists in the client node's configured HostVolumes. When a requested volume source is absent from clientVolumesByName, it appends \"missing <source>\" to a multierror. This protects against using volumes that vanished after a client restart.","triggerScenarios":"Job requests a volume_mount with a source not present in the Nomad client's host_volume stanza config; validateHostVolumes is called by prepareHostVolumes during Prestart and iterates the task's volume mounts, appending one error per unknown source.","commonSituations":"Client agent restarted and lost its host_volume stanza (client config file changed); volume name typo in the job; volume only defined on a different node and the job landed here; per-Alloc suffix mismatch when the volume uses per_alloc.","solutions":["Add the missing host_volume stanza to the client's config and restart the nomad agent","Fix the volume source name in the job's volume_mount to match the client config","Reschedule the job on a node that has the volume configured (use constraint based on client volume metadata)","Check `nomad node status <id> -volumes`-style inspection / client config to compare requested vs configured sources"],"exampleFix":"// client.hcl: before\n# (no host_volume stanza)\n// after\nhost_volume \"shared-data\" {\n  path      = \"/srv/shared\"\n  read_only = false\n}","handlingStrategy":"validation","validationCode":"// validate the job against the node's configured volumes before submit\n// CLI: nomad job validate job.nomad.hcl  (surfaces missing volume sources)\n// in CI: parse client config and assert every volume_mount source exists in host_volume stanzas","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `nomad job validate` in CI for every job change","Keep host_volume stanzas in versioned client config; deploy config and volumes together","Use node constraints/metadata to target nodes that declare the volumes","After any client config change, verify volumes with node inspection before draining/rescheduling"],"tags":["nomad","volumes","config","host-volume"],"backgroundTag":"missing-host-volume","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"}