{"record":{"id":"4fa64c641110b63d","repo":"hashicorp/nomad","slug":"failed-to-get-free-disk-space-for-s-v","errorCode":null,"errorMessage":"failed to get free disk space for %s: %v","messagePattern":"failed to get free disk space for (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/fingerprint/storage_windows.go","lineNumber":32,"sourceCode":"//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":14,"sourceCodeEnd":37,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/fingerprint/storage_windows.go#L14-L37","documentation":"diskInfo() calls getDiskSpaceEx (a wrapper around GetDiskFreeSpaceEx) to read the total bytes of the volume. If the Windows API call fails, this error wraps the OS reason. Commonly the volume does not exist, is not mounted, or the process lacks permission to query it.","triggerScenarios":"Storage fingerprint on Windows where getDiskSpaceEx returns a nonzero error — e.g. the drive letter/volume is absent, a mapped network drive is unreachable, or access is denied.","commonSituations":"Client config references a drive letter that isn't mounted (E:\\ on a host with only C:); disconnected SMB/network share; removable drive unplugged; BitLocker-locked volume; insufficient privileges for the Nomad service account.","solutions":["Verify the volume path exists and is mounted (dir <path> or Get-PSDrive in PowerShell)","If it's a network drive, restore connectivity or use a local volume in the fingerprint paths","Grant the Nomad client's service account permission to query the volume","Unlock/repair the volume (BitLocker, chkdsk) if the underlying error indicates a filesystem problem"],"exampleFix":"// before (client config)\nfingerprint {\n  storage { \n  }\n} // client erroring on \"E:\\\"\n// after\n# ensure only mounted volumes are presented, or fix the host:\nNew-Partition -DiskNumber 1 -DriveLetter E | Format-Volume","handlingStrategy":"try-catch","validationCode":"if fi, err := os.Stat(path); err != nil || !fi.IsDir() {\n    return fmt.Errorf(\"volume path %s is not accessible on this host\", path)\n}","typeGuard":"func isQueryableVolume(p string) bool {\n    _, err := os.Stat(filepath.VolumeName(mustAbs(p)) + \"\\\\\")\n    return err == nil\n}","tryCatchPattern":"volume, total, err := fp.diskInfo(path)\nif err != nil {\n    var se syscall.Errno\n    if errors.As(err, &se) && (errors.Is(err, os.ErrNotExist) || se == syscall.ERROR_ACCESS_DENIED) {\n        log.Printf(\"volume %s unavailable: %v\", path, err)\n        return nil\n    }\n    return err\n}","preventionTips":["Ensure all drive letters referenced by the client config are mounted (check with Get-PSDrive)","Run the Nomad service under an account with rights to query target volumes","Avoid fingerprinting disconnected network shares; verify connectivity first","Keep volumes unlocked (BitLocker) and healthy (periodic chkdsk)"],"tags":["windows","filesystem","disk-space","fingerprinting"],"backgroundTag":"disk-space-query-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"}