{"record":{"id":"f984daa9267c7c3f","repo":"hashicorp/nomad","slug":"cannot-register-volume-host-path-is-required","errorCode":null,"errorMessage":"cannot register volume: host path is required","messagePattern":"cannot register volume: host path is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/host_volume_endpoint.go","lineNumber":354,"sourceCode":"\t\treturn structs.ErrPermissionDenied\n\t}\n\t// Check if override is set and we do not have permissions\n\tif args.PolicyOverride {\n\t\tif !aclObj.AllowNsOp(vol.Namespace, acl.NamespaceCapabilitySentinelOverride) {\n\t\t\treturn structs.ErrPermissionDenied\n\t\t}\n\t}\n\n\tsnap, err := v.srv.State().Snapshot()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif vol.NodeID == \"\" {\n\t\treturn errors.New(\"cannot register volume: node ID is required\")\n\t}\n\tif vol.HostPath == \"\" {\n\t\treturn errors.New(\"cannot register volume: host path is required\")\n\t}\n\n\texisting, err := v.validateVolumeUpdate(vol, snap)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set zero values as needed, possibly from existing\n\tnow := time.Now()\n\tvol.CanonicalizeForRegister(existing, now)\n\n\t// make sure any nodes or pools actually exist\n\terr = v.validateVolumeForState(vol, snap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"validating volume %q against state failed: %v\", vol.ID, err)\n\t}\n\n\twarn, err := v.enforceEnterprisePolicy(","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/host_volume_endpoint.go#L336-L372","documentation":"Validation in the host volume Register RPC: a volume registration omits HostPath. Static host volumes registered via the API must point at an existing absolute path on the target node; an empty path would mount nothing.","triggerScenarios":"Registering a host volume via the API/CLI with the HostPath field omitted or set to \"\"; templated volume manifests where the path variable failed to interpolate.","commonSituations":"Copied CSI volume specs (which have no host path) reused for host volumes; config generation tools emitting empty host_path; manual JSON crafted against /v1/volumes/host/register.","solutions":["Provide host_path (HostPath) with an absolute path existing on the target node","Check templating/variable interpolation so the path is not empty at submit time","Validate client-side before the RPC that both node_id and host_path are non-empty","Ensure the path exists on the node and is permitted by the client's host volume enabled/denylist config"],"exampleFix":"// before\njob 'data' { host_volume \"data\" { } }\n// after\nhost_volume \"data\" {\n  path = \"/opt/data\"\n}","handlingStrategy":"validation","validationCode":"// shell\n[ -n \"$HOST_PATH\" ] || { echo 'host path required'; exit 1; }\nnomad node status \"$NODE_ID\" >/dev/null 2>&1\n[ -d \"$HOST_PATH\" ] || { echo \"path $HOST_PATH missing on node\"; exit 1; }","typeGuard":null,"tryCatchPattern":"// Go\nif vol.HostPath == \"\" {\n    return fmt.Errorf(\"host volume requires a host_path\")\n}\n_, _, err := client.HostVolumes().Register(vol, nil)","preventionTips":["Verify templating tools interpolated host_path before submission","Confirm the path exists on the target node and is allowed by client host_volume config","Add pre-submit validation for both node_id and host_path","Separate CSI and host-volume templates so fields aren't confused"],"tags":["nomad","host-volume","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"}