{"record":{"id":"ef601ee658f7d15a","repo":"astrid-runtime/astrid","slug":"running-daemon-returned-a-malformed-live-capsule-u","errorCode":null,"errorMessage":"running daemon returned a malformed live capsule unload response","messagePattern":"running daemon returned a malformed live capsule unload response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/capsule/live_load.rs","lineNumber":172,"sourceCode":"\n    let raw = client\n        .read_until_topic(response_topic.as_str(), std::time::Duration::from_secs(15))\n        .await\n        .context(\"running daemon did not confirm live capsule unload\")?;\n\n    match crate::socket_client::SocketClient::extract_kernel_response(&raw) {\n        Some(KernelResponse::Success(data)) => {\n            match data.get(\"status\").and_then(serde_json::Value::as_str) {\n                Some(\"unloaded\") => Ok(LiveUnload::Unloaded),\n                Some(\"not_loaded\") => Ok(LiveUnload::NotLoaded),\n                Some(other) => bail!(\"running daemon returned unknown unload status {other:?}\"),\n                None => bail!(\"running daemon returned unload success without a status\"),\n            }\n        },\n        Some(KernelResponse::Error(reason)) => {\n            bail!(\"running daemon declined live capsule unload: {reason}\")\n        },\n        _ => bail!(\"running daemon returned a malformed live capsule unload response\"),\n    }\n}\n\nasync fn daemon_socket_reachable() -> bool {\n    let path = crate::socket_client::proxy_socket_path();\n    matches!(\n        astrid_core::local_transport::connect_outcome(&path).await,\n        Ok(astrid_core::local_transport::ConnectOutcome::Connected(_))\n    )\n}\n\nfn classify_live_client<T>(\n    result: crate::socket_client::WorkspaceConnectionResult<T>,\n) -> anyhow::Result<Option<T>> {\n    match result {\n        Ok(client) => Ok(Some(client)),\n        Err(crate::socket_client::WorkspaceConnectionError::Connect(_)) => Ok(None),\n        Err(crate::socket_client::WorkspaceConnectionError::Selection(error)) => Err(error),","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/capsule/live_load.rs#L154-L190","documentation":"try_daemon_unload throws this when the raw response read from the daemon socket cannot be extracted into any recognized KernelResponse variant at all. This means the message on the response topic was malformed, of an unexpected type, or absent expected structure — a transport-level or schema-level anomaly rather than a daemon decision.","triggerScenarios":"UnloadCapsule response read via read_until_topic does not parse as KernelResponse::Success or KernelResponse::Error (corrupt JSON, wrong topic payload, foreign message on the kernel_response topic, schema drift).","commonSituations":"Mixed CLI/daemon versions exchanging incompatible IPC payloads; another process publishing onto the same MQTT/socket topic; truncated or corrupted IPC message under load.","solutions":["Restart the daemon and retry the unload to rule out a one-off corrupted message.","Verify CLI and daemon versions match (same release) so the IPC schema agrees.","Inspect the daemon logs and the socket traffic for a foreign publisher writing to the kernel response topic."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure only the expected daemon is bound to the proxy socket\nlet reachable = daemon_socket_reachable().await;","typeGuard":"fn is_malformed_response(e: &anyhow::Error) -> bool {\n    e.to_string().contains(\"malformed live capsule unload response\")\n}","tryCatchPattern":"match try_daemon_unload(...).await {\n    Err(e) if is_malformed_response(&e) => {\n        // retry once after reconnecting; then restart daemon\n    }\n    r => r?,\n}","preventionTips":["Run CLI and daemon from the same build.","Ensure no other process publishes on the kernel response topics.","Reconnect the socket client before retrying after a malformed reply."],"tags":["ipc","protocol","malformed-response"],"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-17T15:17:12.973Z"}