{"record":{"id":"c96acf14c900cbef","repo":"astrid-runtime/astrid","slug":"kernel-returned-an-unexpected-storage-mount-respon","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-fskit/src/main.rs","lineNumber":293,"sourceCode":"    })\n}\n\nfn authorize_stale_cleanup(\n    lease_is_live: bool,\n    requested_by: &astrid_core::PrincipalId,\n    acting_principal: &astrid_core::PrincipalId,\n) -> Result<()> {\n    if !lease_is_live && requested_by != acting_principal {\n        bail!(\"stale mount recovery belongs to another acting principal\");\n    }\n    Ok(())\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":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-provider-fskit/src/main.rs#L275-L311","documentation":"lease_from_response() expects the kernel to answer a mount request with AdminResponseBody::StorageMountLease. Any other non-Error variant means the kernel replied with an unexpected response shape, so the companion bails rather than proceeding without a valid lease.","triggerScenarios":"mount() receives an AdminResponseBody that is neither StorageMountLease nor Error — e.g. a Success or unrelated variant caused by a protocol/request-type mismatch between companion and kernel.","commonSituations":"Version-skewed kernel that responds with a different body type for mount requests; routing bug in the kernel admin channel returning the wrong variant; a proxy or wrapper intercepting and reshaping responses.","solutions":["Ensure the kernel and companion are built from matching versions so response variants line up","Inspect the admin channel for proxies/transformations altering the response body","Capture and log the actual AdminResponseBody variant received to confirm the protocol mismatch"],"exampleFix":"// before\nlet lease = lease_from_response(body)?; // unexpected variant, unclear why\n// after\nlog::debug!(\"kernel response variant: {:?}\", std::mem::discriminant(&body));\nlet lease = lease_from_response(body)?;","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// rust\nfn is_storage_mount_lease(body: &AdminResponseBody) -> bool {\n    matches!(body, AdminResponseBody::StorageMountLease(_))\n}","tryCatchPattern":"// rust\nif !is_storage_mount_lease(&body) {\n    eprintln!(\"unexpected kernel response for mount: {body:?}\");\n    // check kernel/companion version skew before retrying\n}","preventionTips":["Keep kernel and companion on matching builds so response variants align","Match requests to the correct admin endpoint/request type","Log unexpected AdminResponseBody variants for protocol debugging"],"tags":["protocol","unexpected-response","mount","rust"],"backgroundTag":"unexpected-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"}