{"record":{"id":"19d8fc527a77f9ad","repo":"hashicorp/nomad","slug":"failed-to-determine-absolute-path-for-s-19d8fc","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_windows.go","lineNumber":21,"sourceCode":"\npackage fingerprint\n\nimport (\n\t\"fmt\"\n\t\"path/filepath\"\n\t\"syscall\"\n)\n\n//go:generate go run golang.org/x/sys/windows/mkwinsyscall -output zstorage_windows.go storage_windows.go\n\n//sys\tgetDiskSpaceEx(dirName *uint16, availableFreeBytes *uint64, totalBytes *uint64, totalFreeBytes *uint64) (err error) = kernel32.GetDiskFreeSpaceExW\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\tvolume = filepath.VolumeName(absPath)\n\n\tabsPathp, err := syscall.UTF16PtrFromString(absPath)\n\tif err != nil {\n\t\treturn \"\", 0, fmt.Errorf(\"failed to convert \\\"%s\\\" to UTF16: %v\", absPath, err)\n\t}\n\n\tif err := getDiskSpaceEx(absPathp, nil, &total, nil); err != nil {\n\t\treturn \"\", 0, fmt.Errorf(\"failed to get free disk space for %s: %v\", absPath, err)\n\t}\n\n\treturn volume, total, nil\n}\n","sourceCodeStart":3,"sourceCodeEnd":37,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/fingerprint/storage_windows.go#L3-L37","documentation":"storage_windows.go diskInfo() calls filepath.Abs(path) to resolve the host volume path into an absolute path before inspecting the filesystem. filepath.Abs only fails when Getwd fails or the path is unresolvable, so this wraps that rare OS-level failure. The error preserves the original relative path but drops the underlying error detail.","triggerScenarios":"Fingerprinting a storage volume on Windows where filepath.Abs(path) returns an error — i.e. the current working directory has been deleted or is inaccessible so Getwd fails, or a malformed path reference cannot be resolved.","commonSituations":"Nomad client process started from a directory that was later removed; corrupted working directory on the Windows host; path passed to the storage fingerprint contains invalid characters preventing resolution.","solutions":["Start the Nomad client from a valid, existing working directory (or set one explicitly in the service definition)","Verify the path string given to the fingerprint contains valid Windows path characters","Check the underlying Getwd failure: ensure the process CWD exists and the user has permission to it","Upgrade Nomad — newer versions propagate the wrapped error for easier diagnosis"],"exampleFix":"// before (library code, for context)\nabsPath, err := filepath.Abs(path)\nif err != nil {\n    return \"\", 0, fmt.Errorf(\"failed to determine absolute path for %s\", path)\n}\n// after (if patching the library to keep the cause)\nabsPath, err := filepath.Abs(path)\nif err != nil {\n    return \"\", 0, fmt.Errorf(\"failed to determine absolute path for %s: %w\", path, err)\n}","handlingStrategy":"try-catch","validationCode":"if path == \"\" || strings.ContainsAny(path, \"\\x00\") {\n    return errors.New(\"storage fingerprint path is empty or contains NUL bytes\")\n}","typeGuard":"func isResolvablePath(p string) bool {\n    abs, err := filepath.Abs(p)\n    return err == nil && abs != \"\"\n}","tryCatchPattern":"volume, total, err := fp.diskInfo(path)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to determine absolute path\") {\n        log.Printf(\"skipping storage fingerprint: bad path %q (check CWD): %v\", path, err)\n        return nil // degrade gracefully\n    }\n    return err\n}","preventionTips":["Launch Nomad client from a stable working directory that will not be deleted","Validate configured paths at startup before fingerprinting begins","Strip NUL/invalid characters from any path sourced from external input"],"tags":["windows","filesystem","fingerprinting"],"backgroundTag":"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"}