{"record":{"id":"8ba4e2d7f9ffdcfe","repo":"astrid-runtime/astrid","slug":"kernel-returned-an-unexpected-storage-mount-respon-8ba4e2","errorCode":null,"errorMessage":"kernel returned an unexpected storage mount response","messagePattern":"kernel returned an unexpected storage mount response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-provider-winfsp/src/main.rs","lineNumber":307,"sourceCode":"        )?;\n    }\n    update_registry(|registry| {\n        registry.mounts.remove(&path_key(&record.mountpoint)?);\n        Ok(())\n    })?;\n    if record.auto_created_mountpoint {\n        let _ = std::fs::remove_dir(&record.mountpoint);\n    }\n    Ok(StorageProviderSuccessV1::Unmounted {\n        mount_id: record.mount_id,\n    })\n}\n\nfn lease_from_response(body: AdminResponseBody) -> Result<StorageMountLeaseV1> {\n    match body {\n        AdminResponseBody::StorageMountLease(lease) => Ok(*lease),\n        AdminResponseBody::Error(error) => bail!(\"kernel refused storage mount: {error}\"),\n        _ => bail!(\"kernel returned an unexpected storage mount response\"),\n    }\n}\n\nfn into_success(body: AdminResponseBody) -> Result<serde_json::Value> {\n    match body {\n        AdminResponseBody::Success(value) => Ok(value),\n        AdminResponseBody::Error(error) => {\n            bail!(\"kernel refused storage lifecycle request: {error}\")\n        },\n        _ => bail!(\"kernel returned an unexpected storage lifecycle response\"),\n    }\n}\n\nfn unmount_status(body: AdminResponseBody) -> Result<bool> {\n    match body {\n        AdminResponseBody::Success(_) => Ok(true),\n        AdminResponseBody::Error(error)\n            if error.contains(\"was not found\") || error.contains(\"expired or revoked\") =>","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-provider-winfsp/src/main.rs#L289-L325","documentation":"This error is thrown by `lease_from_response` in the WinFsp storage provider when the kernel's admin response to a storage mount request is neither a `StorageMountLease` nor an `Error` variant of `AdminResponseBody`. It signals a protocol mismatch: the provider received a well-formed response envelope but of an unexpected kind, so it cannot extract the mount lease. This guards against desynchronizing the local filesystem state from the kernel's actual mount state.","triggerScenarios":"Calling `mount` when the kernel replies to the storage mount admin request with an `AdminResponseBody` variant other than `StorageMountLease` or `Error` — e.g. a plain `Success` value or any newer/other response type the provider does not recognize.","commonSituations":"Running a kernel (astrald) version that emits a different response schema than the provider expects; a version skew between provider and kernel after an API change; routing the mount request to the wrong admin endpoint that returns a generic success payload.","solutions":["Upgrade or downgrade the astrid-storage-provider-winfsp provider so its version matches the running kernel's admin API","Check the kernel logs to see what response body was actually returned for the mount request","Verify the mount request is being sent to the correct admin endpoint that returns a StorageMountLease"],"exampleFix":"// before: match on only two variants\nmatch body {\n    AdminResponseBody::StorageMountLease(lease) => Ok(*lease),\n    AdminResponseBody::Error(error) => bail!(\"kernel refused storage mount: {error}\"),\n    _ => bail!(\"kernel returned an unexpected storage mount response\"),\n}\n// after: handle the new variant explicitly\nmatch body {\n    AdminResponseBody::StorageMountLease(lease) => Ok(*lease),\n    AdminResponseBody::StorageMountLeaseV2(lease) => Ok(lease.into_v1()),\n    AdminResponseBody::Error(error) => bail!(\"kernel refused storage mount: {error}\"),\n    _ => bail!(\"kernel returned an unexpected storage mount response\"),\n}","handlingStrategy":"try-catch","validationCode":"// Rust: no pre-call validation of the response variant is possible; verify provider/kernel version compatibility before mounting\nfn versions_compatible(provider: &str, kernel: &str) -> bool { /* compare admin API versions */ true }","typeGuard":"fn is_mount_lease(body: &AdminResponseBody) -> bool {\n    matches!(body, AdminResponseBody::StorageMountLease(_) | AdminResponseBody::Error(_))\n}","tryCatchPattern":"match provider.mount(request).await {\n    Ok(lease) => use_lease(lease),\n    Err(e) if e.to_string().contains(\"unexpected storage mount response\") => {\n        // version skew: log and surface an upgrade hint\n        log::error!(\"kernel/provider admin API mismatch: {e}\");\n    },\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Pin provider and kernel versions to a tested compatibility matrix","Add integration tests covering all AdminResponseBody variants","Monitor kernel release notes for admin API response changes"],"tags":["ipc","protocol-mismatch","winfsp","storage"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}