astrid-runtime/astrid · error
WinFsp directory mountpoint must not already exist: {}
Error message
WinFsp directory mountpoint must not already exist: {} What it means
WinFsp creates and owns the directory mountpoint leaf itself; the provider therefore requires that the final leaf path does NOT already exist. `prepare_mountpoint` checks `symlink_metadata` on the mountpoint and bails if anything (file, directory, or symlink) is present, so cleanup on failure/unmount stays idempotent and WinFsp can create the leaf cleanly.
Source
Thrown at crates/astrid-storage-provider-winfsp/src/main.rs:372
}
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) {
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {},
Err(error) => {
return Err(error)
.with_context(|| format!("inspect mountpoint {}", mountpoint.display()));
},
Ok(_) => bail!(
"WinFsp directory mountpoint must not already exist: {}",
mountpoint.display()
),
}
// WinFsp creates and owns directory mountpoint leaves. Treat the leaf as
// provider-created so failure and unmount cleanup remain idempotent.
Ok((mountpoint, true))
}
#[cfg(not(windows))]
fn prepare_mountpoint(
_requested: Option<PathBuf>,
_view: &astrid_core::storage_provider::StorageProviderViewV1,
) -> Result<(PathBuf, bool)> {
bail!("the WinFsp provider is available only on Windows")
}
#[cfg(windows)]View on GitHub (pinned to affd8760f4)
Solutions
- Delete the existing empty directory at the mountpoint path, then retry the mount
- Choose a different mountpoint leaf path
- If the leftover is a live mount, unmount it properly first via the provider's `unmount`
Example fix
// before
std::fs::create_dir_all("C:\\mounts\\storage")?; // pre-creating the leaf breaks WinFsp
mount(provider, Some(PathBuf::from("C:\\mounts\\storage"))).await?;
// after: let WinFsp create the leaf
mount(provider, Some(PathBuf::from("C:\\mounts\\storage"))).await?; Defensive patterns
Strategy: validation
Validate before calling
// Ensure the mountpoint leaf does not exist before mounting
fn leaf_free(mountpoint: &std::path::Path) -> bool {
matches!(std::fs::symlink_metadata(mountpoint), Err(e) if e.kind() == std::io::ErrorKind::NotFound)
} Prevention
- Never pre-create the mountpoint leaf directory — WinFsp owns it
- Update old scripts that mkdir the mount target before mounting
- After unclean shutdowns, remove leftover empty leaf directories before remounting
When it happens
Trigger: Calling `mount` with a directory mountpoint path where the leaf already exists — e.g. a previous mount crashed without cleanup, the user pre-created the folder, or a stale empty directory was left behind.
Common situations: Re-mounting after an unclean shutdown or provider crash that left the empty leaf directory; scripts that `mkdir` the mountpoint first out of habit from other FUSE-like tools; leftover directories from an uninstalled setup.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
- mountpoint must be absolute
- mountpoint parent is not a directory: {}
- no free Windows drive target is available; specify a directo
- WinFsp failed to start private mount: {status:#x}
- mountpoint is already registered: {}
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/342c9e29b0e69a2a.
Report an issue: GitHub.