hashicorp/nomad · error
failed to get free disk space for %s: %v
Error message
failed to get free disk space for %s: %v
What it means
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.
Source
Thrown at client/fingerprint/storage_windows.go:32
//sys getDiskSpaceEx(dirName *uint16, availableFreeBytes *uint64, totalBytes *uint64, totalFreeBytes *uint64) (err error) = kernel32.GetDiskFreeSpaceExW
// diskInfo inspects the filesystem for path and returns the volume name and
// the total bytes available on the file system.
func (f *StorageFingerprint) diskInfo(path string) (volume string, total uint64, err error) {
absPath, err := filepath.Abs(path)
if err != nil {
return "", 0, fmt.Errorf("failed to determine absolute path for %s", path)
}
volume = filepath.VolumeName(absPath)
absPathp, err := syscall.UTF16PtrFromString(absPath)
if err != nil {
return "", 0, fmt.Errorf("failed to convert \"%s\" to UTF16: %v", absPath, err)
}
if err := getDiskSpaceEx(absPathp, nil, &total, nil); err != nil {
return "", 0, fmt.Errorf("failed to get free disk space for %s: %v", absPath, err)
}
return volume, total, nil
}
View on GitHub (pinned to 482b49bf1a)
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
Example fix
// before (client config)
fingerprint {
storage {
}
} // client erroring on "E:\"
// after
# ensure only mounted volumes are presented, or fix the host:
New-Partition -DiskNumber 1 -DriveLetter E | Format-Volume Defensive patterns
Strategy: try-catch
Validate before calling
if fi, err := os.Stat(path); err != nil || !fi.IsDir() {
return fmt.Errorf("volume path %s is not accessible on this host", path)
} Type guard
func isQueryableVolume(p string) bool {
_, err := os.Stat(filepath.VolumeName(mustAbs(p)) + "\\")
return err == nil
} Try / catch
volume, total, err := fp.diskInfo(path)
if err != nil {
var se syscall.Errno
if errors.As(err, &se) && (errors.Is(err, os.ErrNotExist) || se == syscall.ERROR_ACCESS_DENIED) {
log.Printf("volume %s unavailable: %v", path, err)
return nil
}
return err
} Prevention
- 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)
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- failed to determine disk space for %s: %v
- failed to determine absolute path for %s
- Windows directory creation not supported on this platform
- unable to get CWD from filesystem: %s
- failed to determine absolute path for %s
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/4fa64c641110b63d.
Report an issue: GitHub.