astrid-runtime/astrid · error

kernel refused storage lifecycle request: {error}

Error message

kernel refused storage lifecycle request: {error}

What it means

kernel_lease_status queries the kernel's AdminClient with StorageMountStatus. When the kernel replies with AdminResponseBody::Error that is not a recognized 'not found' / 'expired or revoked' condition, the provider treats it as a hard refusal of the storage lifecycle request and bails with the kernel's error text inlined. Only Success and the two recognized soft-failure strings are accepted.

Source

Thrown at crates/astrid-storage-provider-fuse/src/main.rs:765

) -> Result<Option<LeaseStatus>> {
    let body = client
        .request(AdminRequestKind::StorageMountStatus {
            mount_id: *mount_id,
        })
        .await?;
    match body {
        AdminResponseBody::Success(value) => {
            let status =
                serde_json::from_value(value).context("decode kernel storage mount status")?;
            Ok(Some(status))
        },
        AdminResponseBody::Error(error)
            if error.contains("was not found") || error.contains("expired or revoked") =>
        {
            Ok(None)
        },
        AdminResponseBody::Error(error) => {
            bail!("kernel refused storage lifecycle request: {error}")
        },
        _ => bail!("kernel returned an unexpected storage lifecycle response"),
    }
}

async fn require_live_lease(
    client: &mut AdminClient,
    acting_principal: &astrid_core::PrincipalId,
    record: &registry::MountRecord,
) -> Result<LeaseStatus> {
    if &record.requested_by != acting_principal {
        bail!("mount was issued to another acting principal");
    }
    kernel_lease_status(client, &record.mount_id)
        .await?
        .with_context(|| format!("storage mount lease {} is stale", record.mount_id))
}

View on GitHub (pinned to affd8760f4)

Solutions

  1. Read the kernel error text after the colon and address the kernel-side cause (usually authorization or request validity)
  2. If a kernel upgrade changed error wording, update the substring match at main.rs:760 so soft 'not found' cases are still recognized
  3. Verify the acting principal has kernel admin permission for storage mount operations
  4. Re-check the StorageMountId being sent matches a lease the kernel knows

Example fix

// before: brittle substring match
if error.contains("was not found") || error.contains("expired or revoked") { Ok(None) }
// after: typed variants where possible
AdminResponseBody::Error(AdminError::NotFound(_)) | AdminResponseBody::Error(AdminError::LeaseExpired) => Ok(None),
Defensive patterns

Strategy: try-catch

Validate before calling

// Before lifecycle calls, confirm the acting principal has kernel admin rights
let permitted = client.request(AdminRequestKind::WhoAmI).await?;
if !permitted.implies_admin_storage() { return Err(anyhow!("principal lacks kernel storage admin rights")); }

Type guard

fn is_soft_miss(err: &str) -> bool {
    err.contains("was not found") || err.contains("expired or revoked")
}

Try / catch

match kernel_lease_status(client, &mount_id).await {
    Err(e) if e.to_string().contains("kernel refused storage lifecycle request:") => {
        let kernel_msg = extract_kernel_message(&e);
        if is_soft_miss(kernel_msg) { handle_as_absent() } else { return Err(e); }
    }
    other => other,
}

Prevention

When it happens

Trigger: An admin API call (StorageMountStatus, and same helper used around revoke/renew) returns AdminResponseBody::Error whose message lacks the 'was not found' or 'expired or revoked' substrings — e.g. permission denied at the kernel, malformed mount_id, kernel-side internal error, or a kernel version whose error wording changed.

Common situations: Calling lifecycle operations with a principal lacking kernel admin rights; kernel upgraded so its error strings no longer match the hardcoded 'was not found'/'expired or revoked' patterns, turning soft misses into hard errors; sending a corrupt mount_id.

Related errors


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