{"record":{"id":"7ee70a60e7a1f2b7","repo":"astrid-runtime/astrid","slug":"kernel-returned-an-unexpected-storage-lifecycle-re","errorCode":null,"errorMessage":"kernel returned an unexpected storage lifecycle response","messagePattern":"kernel returned an unexpected storage lifecycle response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-provider-fskit/src/main.rs","lineNumber":303,"sourceCode":"    }\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\") =>\n        {\n            Ok(false)\n        },\n        AdminResponseBody::Error(error) => {\n            bail!(\"kernel refused storage unmount authorization: {error}\")\n        },\n        _ => bail!(\"kernel returned an unexpected storage unmount response\"),\n    }\n}\n","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-provider-fskit/src/main.rs#L285-L321","documentation":"into_success() pattern-matches the AdminResponseBody and only accepts Success or Error variants; any other variant (e.g. a lease payload returned where a plain ack was expected) triggers this bail. It indicates a protocol/shape mismatch between the provider and the kernel rather than a refused operation.","triggerScenarios":"A lifecycle request in execute() or unmount() returns a non-Success, non-Error AdminResponseBody variant — typically after a kernel version change that altered the AdminResponseBody enum, or a corrupted/misdeserialized reply.","commonSituations":"Kernel and fskit provider built from mismatched versions; a request that unexpectedly returns a StorageMountLease where Success was expected; middleware or proxy rewriting kernel responses.","solutions":["Rebuild both the kernel and the fskit provider from the same commit so the AdminResponseBody enum matches.","Check which AdminRequestKind was sent and whether its documented response variant changed; update into_success() to handle the new variant.","Log the raw response body to identify which variant was actually received."],"exampleFix":"// before\n_ => bail!(\"kernel returned an unexpected storage lifecycle response\"),\n// after: accept a lease payload where the kernel now returns one\nAdminResponseBody::StorageMountLease(_) => Ok(serde_json::Value::Null),\n_ => bail!(\"kernel returned an unexpected storage lifecycle response\"),","handlingStrategy":"type-guard","validationCode":"// verify build compatibility before shipping: same AdminResponseBody schema in kernel and provider","typeGuard":"fn is_lifecycle_body(body: &AdminResponseBody) -> bool {\n    matches!(body, AdminResponseBody::Success(_) | AdminResponseBody::Error(_))\n}","tryCatchPattern":"match into_success(body) {\n    Ok(v) => Ok(v),\n    Err(e) if e.to_string().contains(\"unexpected storage lifecycle response\") => {\n        Err(e.context(\"kernel/provider protocol mismatch\"))\n    },\n    Err(e) => Err(e),\n}","preventionTips":["Build and deploy kernel and fskit provider from the same commit/tag.","Add integration tests covering every AdminRequestKind and its response variant.","Log the raw AdminResponseBody variant on this error to speed diagnosis."],"tags":["protocol-mismatch","admin-client","version-skew"],"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-14T11:17:12.474Z"}