astrid-runtime/astrid · error
Windows drive target is already in use: {}
Error message
Windows drive target is already in use: {} What it means
When the requested mountpoint is a drive target (a drive root like `F:\`), `prepare_mountpoint` checks whether that drive already exists via `std::fs::metadata`. If metadata succeeds, the drive letter is occupied (by another volume, subst mapping, or network drive) and WinFsp cannot claim it, so the provider bails with this message including the offending path.
Source
Thrown at crates/astrid-storage-provider-winfsp/src/main.rs:348
bail!("kernel refused storage unmount authorization: {error}")
},
_ => bail!("kernel returned an unexpected storage unmount response"),
}
}
#[cfg(windows)]
fn prepare_mountpoint(
requested: Option<PathBuf>,
view: &astrid_core::storage_provider::StorageProviderViewV1,
) -> Result<(PathBuf, bool)> {
let _ = view;
let mountpoint = requested.map_or_else(first_free_drive, Ok)?;
if !mountpoint.is_absolute() {
bail!("mountpoint must be absolute");
}
if is_drive_target(&mountpoint) {
if std::fs::metadata(&mountpoint).is_ok() {
bail!(
"Windows drive target is already in use: {}",
mountpoint.display()
);
}
return Ok((mountpoint, false));
}
let parent = mountpoint
.parent()
.context("WinFsp directory mountpoint has no parent")?;
std::fs::create_dir_all(parent)
.with_context(|| format!("create mountpoint parent {}", parent.display()))?;
astrid_core::platform_fs::verify_no_redirects(parent)
.with_context(|| format!("reject redirected mountpoint parent {}", parent.display()))?;
if !std::fs::symlink_metadata(parent)?.is_dir() {
bail!("mountpoint parent is not a directory: {}", parent.display());
}
match std::fs::symlink_metadata(&mountpoint) {View on GitHub (pinned to affd8760f4)
Solutions
- Choose a different, unused drive letter for the mountpoint
- Unmount or disconnect whatever currently occupies the drive letter, then retry
- Omit the mountpoint argument so `first_free_drive` automatically picks a free letter from D: to Z:
Example fix
// before
mount(provider, Some(PathBuf::from("E:\\"))).await?; // E: already in use
// after
mount(provider, None).await?; // auto-picks first free drive Defensive patterns
Strategy: validation
Validate before calling
// Check drive availability before requesting it
fn drive_free(letter: char) -> bool {
!std::fs::metadata(format!("{letter}:\\")).is_ok()
}
if !drive_free('E') { /* pick another letter or pass None for auto-select */ } Prevention
- Don't hard-code drive letters in configs or scripts
- Pass `None` as the mountpoint to let first_free_drive auto-select D:–Z:
- Clean up previous mounts so drive letters are released
When it happens
Trigger: `mount` is called with an explicit drive-root mountpoint (e.g. `E:\`) that already resolves to an existing volume, or a reserved drive letter collides with an existing device on the machine.
Common situations: Hard-coding a drive letter that is already used by a USB stick or mapped network drive on the target machine; re-running a mount without unmounting first; multi-tenant machines where drive letters are contested.
Related errors
- mountpoint must be absolute
- mountpoint parent is not a directory: {}
- WinFsp directory mountpoint must not already exist: {}
- no free Windows drive target is available; specify a directo
- WinFsp failed to start private mount: {status:#x}
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/829713b2daee508a.
Report an issue: GitHub.