{"record":{"id":"436a599f0ee639e3","repo":"hashicorp/nomad","slug":"failed-to-determine-absolute-path-for-s","errorCode":null,"errorMessage":"failed to determine absolute path for %s","messagePattern":"failed to determine absolute path for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/fingerprint/storage_unix.go","lineNumber":22,"sourceCode":"//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris\n\npackage fingerprint\n\nimport (\n\t\"fmt\"\n\t\"os/exec\"\n\t\"path/filepath\"\n\t\"runtime\"\n\t\"strconv\"\n\t\"strings\"\n)\n\n// diskInfo inspects the filesystem for path and returns the volume name and\n// the total bytes available on the file system.\nfunc (f *StorageFingerprint) diskInfo(path string) (volume string, total uint64, err error) {\n\tabsPath, err := filepath.Abs(path)\n\tif err != nil {\n\t\treturn \"\", 0, fmt.Errorf(\"failed to determine absolute path for %s\", path)\n\t}\n\n\t// Use -k to standardize the output values between darwin and linux\n\tvar dfArgs string\n\tif runtime.GOOS == \"linux\" {\n\t\t// df on linux needs the -P option to prevent linebreaks on long filesystem paths\n\t\tdfArgs = \"-kP\"\n\t} else {\n\t\tdfArgs = \"-k\"\n\t}\n\n\tmountOutput, err := exec.Command(\"df\", dfArgs, absPath).Output()\n\tif err != nil {\n\t\treturn \"\", 0, fmt.Errorf(\"failed to determine mount point for %s\", absPath)\n\t}\n\t// Output looks something like:\n\t//\tFilesystem 1024-blocks      Used Available Capacity   iused    ifree %iused  Mounted on\n\t//\t/dev/disk1   487385240 423722532  63406708    87% 105994631 15851677   87%   /","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/fingerprint/storage_unix.go#L4-L40","documentation":"In StorageFingerprint.diskInfo, filepath.Abs fails to compute an absolute path for the host volume path being fingerprinted (e.g. malformed path input), so disk capacity/volume detection for the storage fingerprint cannot proceed and the error propagates to Fingerprint.","triggerScenarios":"diskInfo called with a relative path while the process has no resolvable working directory (os.Getwd fails inside filepath.Abs), e.g. after the CWD was deleted.","commonSituations":"Client started in a deleted directory with a relative alloc_dir configured; restricted environments where Getwd returns ENOENT.","solutions":["Pass an absolute path as the storage/alloc directory.","Recreate the deleted working directory or restart the client from a valid directory.","Check permissions on the process's current directory."],"exampleFix":"// before\nalloc_dir = \"data/alloc\"  // relative, CWD deleted\n// after\nalloc_dir = \"/opt/nomad/data/alloc\"  // absolute","handlingStrategy":"validation","validationCode":"if !filepath.IsAbs(path) {\n\tabs, err := filepath.Abs(path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot resolve %s to absolute path: %w\", path, err)\n\t}\n\tpath = abs\n}","typeGuard":null,"tryCatchPattern":"if err := fp.Fingerprint(req); err != nil {\n\tif strings.Contains(err.Error(), \"failed to determine absolute path\") {\n\t\tlog.Printf(\"path resolution failed: %v\", err)\n\t\treturn nil\n\t}\n\treturn err\n}","preventionTips":["Configure absolute paths for alloc_dir.","Ensure the process has a valid working directory (CWD not deleted).","Test os.Getwd() in startup checks for relative-path setups."],"tags":["filesystem","paths","fingerprinting"],"backgroundTag":"absolute-path-resolution-failed","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"}