{"record":{"id":"52ae29ea1f3e293f","repo":"hashicorp/nomad","slug":"task-driver-q-for-q-does-not-support-host-volume","errorCode":null,"errorMessage":"task driver %q for %q does not support host volumes","messagePattern":"task driver %q for %q does not support host volumes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/taskrunner/volume_hook.go","lineNumber":145,"sourceCode":"\t// if a host is restarted and loses the host volume configuration.\n\tif err := validateHostVolumes(volumes, hostVolumes, req.Alloc.Name); err != nil {\n\t\th.logger.Error(\"Requested Host Volume does not exist\", \"existing\", hostVolumes, \"requested\", volumes)\n\t\treturn nil, fmt.Errorf(\"host volume validation error: %v\", err)\n\t}\n\n\thostVolumeMounts, err := h.hostVolumeMountConfigurations(req.Task.VolumeMounts, volumes, hostVolumes, req.Alloc.Name)\n\tif err != nil {\n\t\th.logger.Error(\"Failed to generate host volume mounts\", \"error\", err)\n\t\treturn nil, err\n\t}\n\n\tif len(hostVolumeMounts) > 0 {\n\t\tcaps, err := h.runner.DriverCapabilities()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not validate task driver capabilities: %v\", err)\n\t\t}\n\t\tif caps.MountConfigs == drivers.MountConfigSupportNone {\n\t\t\treturn nil, fmt.Errorf(\n\t\t\t\t\"task driver %q for %q does not support host volumes\",\n\t\t\t\th.runner.task.Driver, h.runner.task.Name)\n\t\t}\n\t}\n\n\treturn hostVolumeMounts, nil\n}\n\n// partitionMountsByVolume takes a list of volume mounts and returns them in the\n// form of volume-alias:[]volume-mount because one volume may be mounted multiple\n// times.\nfunc partitionMountsByVolume(xs []*structs.VolumeMount) map[string][]*structs.VolumeMount {\n\tresult := make(map[string][]*structs.VolumeMount)\n\tfor _, mount := range xs {\n\t\tresult[mount.Volume] = append(result[mount.Volume], mount)\n\t}\n\n\treturn result","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/taskrunner/volume_hook.go#L127-L163","documentation":"Nomad's volume_hook (volumeHook.prepHostVolumes/prepareHostVolumes) validates during task Prestart that if the task has host (Docker-style) volume mounts configured, the selected task driver advertises MountConfigs support greater than MountConfigSupportNone via its DriverCapabilities. If the driver cannot mount host volumes (or cannot report capabilities), Prestart fails and the allocation is rejected. It is a capability gate, not a transient failure.","triggerScenarios":"A job's task declares a host volume mount (volume_mount with a host_volume source) but the task's driver (e.g. exec, raw_exec, java, or an older driver version) reports drivers.MountConfigSupportNone for MountConfigs; h.runner.DriverCapabilities() is called during volumeHook.Prestart and the returned caps.MountConfigs equals MountConfigSupportNone.","commonSituations":"Running a docker-image-less driver like raw_exec/exec or java that doesn't support host volume binds, but the job template was copied from a docker task that used host volumes; Nomad agent with an outdated or misconfigured plugin whose Capabilities() omits mount support; using host volumes on Windows with a driver lacking bind-mount support; Nomad version mismatch where the driver capability struct predates MountConfigs.","solutions":["Change the task driver to one that supports host volumes (e.g. docker) or remove the volume_mount stanza from the task","Upgrade the driver/plugin (and Nomad client) so DriverCapabilities() reports MountConfigs != MountConfigSupportNone","Verify client config registers the host volume (client { host_volume \"x\" {} }) and that the driver intended for the task is actually the one selected","If you only need shared files, use a template stanza or artifact instead of a host volume"],"exampleFix":"// before\njob \"app\" {\n  group \"g\" {\n    volume \"data\" { type = \"host\" source = \"data\" }\n    task \"worker\" {\n      driver = \"raw_exec\"\n      volume_mount { volume = \"data\" }\n    }\n  }\n}\n// after\ntask \"worker\" {\n  driver = \"docker\"\n  volume_mount { volume = \"data\" }\n}","handlingStrategy":"validation","validationCode":"// Before submitting the job, verify driver mount capability on target nodes:\n// nomad node status <node> shows Driver status; assert capability via driver docs, e.g.:\nif task.Driver != \"docker\" && hasHostVolumeMounts(task) {\n    return fmt.Errorf(\"driver %q does not support host volumes; use docker or drop volume_mount\", task.Driver)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair host_volume_mounted-capable drivers (docker) with any task that declares volume_mount","Read the driver's MountConfigs capability before using host volumes","Add a job constraint on driver/meta attributes so the task only lands on capable clients","Keep Nomad client and driver plugins upgraded so capability reporting is current"],"tags":["nomad","host-volumes","driver-capabilities","prestart"],"backgroundTag":"driver-does-not-support-volume-mount","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"}