astrid-runtime/astrid · error

kernel refused storage unmount authorization: {error}

Error message

kernel refused storage unmount authorization: {error}

What it means

`unmount_status` checks with the kernel whether a mount lease is still valid before unmounting. Errors containing 'was not found' or 'expired or revoked' are treated as 'already unmounted' (returns `Ok(false)`); any other kernel error is surfaced here as a hard refusal, preserving the kernel's message. This distinguishes benign already-gone states from genuine authorization failures.

Source

Thrown at crates/astrid-storage-provider-winfsp/src/main.rs:330

    match body {
        AdminResponseBody::Success(value) => Ok(value),
        AdminResponseBody::Error(error) => {
            bail!("kernel refused storage lifecycle request: {error}")
        },
        _ => bail!("kernel returned an unexpected storage lifecycle response"),
    }
}

fn unmount_status(body: AdminResponseBody) -> Result<bool> {
    match body {
        AdminResponseBody::Success(_) => Ok(true),
        AdminResponseBody::Error(error)
            if error.contains("was not found") || error.contains("expired or revoked") =>
        {
            Ok(false)
        },
        AdminResponseBody::Error(error) => {
            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!(

View on GitHub (pinned to affd8760f4)

Solutions

  1. Inspect the embedded kernel error text for the actual refusal cause
  2. Confirm the lease id and identity used for the unmount request are correct and authorized
  3. If the lease truly no longer exists, ensure the error text matches the expected 'was not found' phrasing or upgrade provider/kernel so phrasing stays in sync
Defensive patterns

Strategy: try-catch

Try / catch

match provider.unmount(lease).await {
    Ok(true) => log::info!("unmounted"),
    Ok(false) => log::info!("already unmounted (lease gone/expired)"),
    Err(e) if e.to_string().contains("refused storage unmount authorization") => {
        // check identity/lease correctness before retrying
    },
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: `unmount` calls `unmount_status` and the kernel returns `AdminResponseBody::Error` whose text does NOT contain 'was not found' or 'expired or revoked' — e.g. permission denied on the lease, malformed lease id, or kernel-internal errors.

Common situations: Unmounting a volume whose lease belongs to another identity/tenant; sending a corrupted or wrong lease reference; kernel experiencing internal errors during lease validation.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


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