astrid-runtime/astrid · error

WinFsp failed to start mount with status {status:#x}

Error message

WinFsp failed to start mount with status {status:#x}

What it means

After constructing the callback FS, the daemon calls WinFsp's FileSystem::start with volume parameters and the UTF-16 mountpoint. If the WinFsp API returns a non-zero NTSTATUS, it is formatted as hex and wrapped in this error, meaning the kernel driver refused the mount.

Source

Thrown at crates/astrid-storage-provider-winfsp/src/win.rs:84

    }

    let runtime = Arc::new(
        tokio::runtime::Builder::new_multi_thread()
            .enable_all()
            .build()
            .context("start WinFsp callback runtime")?,
    );
    let callback = CallbackFs::new(lease.clone(), Arc::clone(&runtime))
        .map_err(|failure| anyhow::anyhow!("build WinFsp callback filesystem: {failure:?}"))?;
    let control_path = provider_control_path(&lease.mount_id)?;
    let control_listener = local_transport::bind(&control_path)
        .with_context(|| format!("bind WinFsp control endpoint {}", control_path.display()))?;
    initialize_winfsp()?;
    let mountpoint = U16CString::from_os_str(start.mountpoint.as_os_str())
        .map_err(|_| anyhow::anyhow!("mountpoint is not valid UTF-16"))?;
    let filesystem = FileSystem::start(volume_params(lease.access), Some(&mountpoint), callback)
        .map_err(|status| {
            anyhow::anyhow!("WinFsp failed to start mount with status {status:#x}")
        })?;
    wait_for_mountpoint_ready(&start.mountpoint)?;

    let mut stdout = std::io::stdout().lock();
    writeln!(stdout, "READY {0}", lease.mount_id).context("report WinFsp readiness")?;
    stdout.flush().context("flush WinFsp readiness")?;

    let result = runtime.block_on(daemon_loop(filesystem, control_listener));
    if let Err(error) = result {
        eprintln!("{PROVIDER_NAME}: daemon stopped after failure: {error:#}");
        return Err(error);
    }
    Ok(())
}

fn wait_for_mountpoint_ready(mountpoint: &Path) -> Result<()> {
    let started = Instant::now();
    loop {

View on GitHub (pinned to affd8760f4)

Solutions

  1. Decode the hex NTSTATUS in the message (e.g. 0xc0000022 = access denied) to identify the cause
  2. Verify WinFsp is installed and the WinFsp driver/service is running (sc query WinFsp.Launcher)
  3. Choose a free, existing mountpoint directory
  4. Check volume_params/access settings against WinFsp requirements and run with sufficient privileges

Example fix

// before: bare status
.map_err(|status| anyhow::anyhow!("WinFsp failed to start mount with status {status:#x}"))?;
// after: add mountpoint context
.map_err(|status| anyhow::anyhow!("WinFsp failed to start mount with status {status:#x}"))
    .with_context(|| format!("mountpoint: {}", start.mountpoint.display()))?;
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight checks before FileSystem::start
// 1. WinFsp installed?
// 2. driver service running?
let ok = std::process::Command::new("sc")
    .args(["query", "WinFsp.Launcher"])
    .output().map(|o| o.status.success()).unwrap_or(false);
if !ok { return Err("WinFsp driver/launcher not running"); }

Try / catch

match result {
    Err(e) if e.to_string().contains("status 0xc0000022") => bail!("access denied: run elevated or fix mountpoint ACLs"),
    Err(e) if e.to_string().contains("failed to start mount") => {
        // verify WinFsp install, free mountpoint, then retry once
    }
    r => r,
}

Prevention

When it happens

Trigger: FileSystem::start fails with statuses like STATUS_ACCESS_DENIED (mountpoint busy or unauthorized), STATUS_OBJECT_NAME_COLLISION (mountpoint already used), STATUS_UNSUCCESSFUL (WinFsp driver not loaded), or invalid volume params.

Common situations: WinFsp not installed or its driver not running; mountpoint already in use by another mount; running without the privileges WinFsp requires; invalid volume parameters for the access mode.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/57fe4b359dd350ca. Report an issue: GitHub.