{"record":{"id":"b372705ec2f82a2c","repo":"hashicorp/nomad","slug":"could-not-verify-host-path-for-q-w","errorCode":null,"errorMessage":"could not verify host path for %q: %w","messagePattern":"could not verify host path for %q: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/hostvolumemanager/host_volumes.go","lineNumber":167,"sourceCode":"\treturn resp, nil\n}\n\n// Register saves the request to state, and updates the node with the volume.\nfunc (hvm *HostVolumeManager) Register(ctx context.Context,\n\treq *cstructs.ClientHostVolumeRegisterRequest) error {\n\n\tlog := hvm.log.With(\"volume_name\", req.Name, \"volume_id\", req.ID)\n\n\t// can't have two of the same volume name w/ different IDs per client node\n\tif _, err := hvm.locker.lock(req.Name, req.ID); err != nil {\n\t\tlog.Error(\"duplicate volume name\", \"error\", err)\n\t\treturn err\n\t}\n\n\t_, err := os.Stat(req.HostPath)\n\tif err != nil {\n\t\thvm.locker.release(req.Name)\n\t\terr = fmt.Errorf(\"could not verify host path for %q: %w\", req.Name, err)\n\t\tlog.Error(\"error registering volume\", \"error\", err)\n\t\treturn err\n\t}\n\n\t// generate a stub create request and plugin response for the fingerprint\n\t// and client state\n\tcreq := &cstructs.ClientHostVolumeCreateRequest{\n\t\tID:         req.ID,\n\t\tName:       req.Name,\n\t\tNodeID:     req.NodeID,\n\t\tParameters: req.Parameters,\n\t}\n\tvolState := &cstructs.HostVolumeState{\n\t\tID:        req.ID,\n\t\tCreateReq: creq,\n\t\tHostPath:  req.HostPath,\n\t}\n\tif err := hvm.stateMgr.PutDynamicHostVolume(volState); err != nil {","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/hostvolumemanager/host_volumes.go#L149-L185","documentation":"Returned by the host volume manager's Register when os.Stat on req.HostPath fails, meaning the path claimed for the volume does not exist or is not accessible on the client node. The manager releases the volume's lock, logs 'error registering volume', and wraps the stat error. Registration is aborted.","triggerScenarios":"Calling Register (via nomad volume register / client host-volume API) with a HostPath that does not exist, was removed, or is not readable by the nomad agent user (including permission on any parent directory).","commonSituations":"Typo in host_path in the volume spec; directory deleted or never created on the client; path exists only on other nodes; bind mount not yet mounted; nomad user lacks traverse permissions; client restarted after host reboot losing the path.","solutions":["Verify the path exists on the specific client node: run stat <path> as the nomad user","Create the directory (mkdir -p) and give the nomad user ownership/read access","Fix the host_path value in the volume specification","If path is node-specific, use a per-node volume or constraint so registration targets the right node","Recreate any mount/bind-mount that disappeared after reboot"],"exampleFix":"// before\nvolume \"web\" { type = \"host\" host_path = \"/srv/data\" }  # /srv/data missing\n// after\n$ sudo mkdir -p /srv/data && sudo chown nomad:nomad /srv/data\nvolume \"web\" { type = \"host\" host_path = \"/srv/data\" }","handlingStrategy":"validation","validationCode":"func ensureHostPath(p string) error {\n    fi, err := os.Stat(p)\n    if err != nil { return err }\n    if !fi.IsDir() { return fmt.Errorf(\"%s is not a directory\", p) }\n    if _, err := os.Stat(filepath.Join(p, \".\")); err != nil {\n        return fmt.Errorf(\"no traverse permission on %s: %w\", p, err)\n    }\n    return nil\n}\n// call before nomad volume register: ensureHostPath(req.HostPath)","typeGuard":"func pathAccessible(p string) bool { _, err := os.Stat(p); return err == nil }","tryCatchPattern":"err := hvm.Register(req)\nif err != nil {\n    var perr *fs.PathError\n    if errors.As(err, &perr) {\n        log.Error(\"host path missing on this node\", \"path\", perr.Path, \"err\", perr)\n        // create the dir or fix the spec before retrying\n    }\n    return err\n}","preventionTips":["stat the host_path on the target client as the nomad user before registering","Use constraints/host volumes so node-specific paths register on the right node","Recreate directories after host reboots if they are tmpfs/ephemeral","Avoid symlinks to paths that may not exist on all clients"],"tags":["host-volumes","filesystem","path-validation"],"backgroundTag":"no-such-file-or-directory","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"}