{"record":{"id":"ee434a46408ee0b1","repo":"astrid-runtime/astrid","slug":"unexpected-daemon-response-other-ee434a","errorCode":null,"errorMessage":"unexpected daemon response: {other:?}","messagePattern":"unexpected daemon response: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/capsule/show.rs","lineNumber":74,"sourceCode":"    /// `not-pinned`.\n    pub contracts_status: String,\n    /// Verbatim `Capsule.toml` body.\n    pub manifest: String,\n    /// Human-facing permissions derived from the manifest.\n    pub permissions: Vec<SemanticCapability>,\n}\n\n/// Entry point for `astrid capsule show`.\npub(crate) async fn run(args: &ShowArgs) -> Result<ExitCode> {\n    let principal = context::resolve_agent(args.agent.as_deref())?;\n    let format = ValueFormat::parse(&args.format);\n    let mut client = crate::socket_client::connect_kernel_for_workspace(None).await?;\n    let entries = match client.request(KernelRequest::GetCapsuleMetadata).await? {\n        KernelResponse::CapsuleMetadata(entries) => entries,\n        KernelResponse::Error(message) => {\n            anyhow::bail!(\"daemon rejected capsule metadata request: {message}\")\n        },\n        other => anyhow::bail!(\"unexpected daemon response: {other:?}\"),\n    };\n    let Some(entry) = entries.into_iter().find(|entry| entry.name == args.name) else {\n        eprintln!(\n            \"{}\",\n            Theme::error(&format!(\n                \"capsule '{}' is not installed for agent '{principal}'\",\n                args.name\n            ))\n        );\n        return Ok(ExitCode::from(1));\n    };\n    let capabilities: astrid_capsule_types::manifest::CapabilitiesDef =\n        serde_json::from_value(entry.capabilities.clone())?;\n    let permissions = semantic_capabilities(&capabilities);\n    let manifest = serde_json::to_string_pretty(&serde_json::json!({\n        \"package\": {\n            \"name\": entry.name,\n            \"version\": entry.version,","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/capsule/show.rs#L56-L92","documentation":"In capsule show's run, any daemon reply to GetCapsuleMetadata that is neither CapsuleMetadata(entries) nor Error(message) causes this bail with the response's debug representation. It indicates the daemon sent a recognized KernelResponse variant that does not fit the request — a protocol/schema mismatch between CLI and daemon. The debug output helps diagnose which variant arrived.","triggerScenarios":"astrid capsule show receives e.g. KernelResponse::Success(..) or an unrelated variant where CapsuleMetadata was expected — typically a daemon built from different versions or a routing mix-up on the response topic.","commonSituations":"CLI upgraded without restarting an old daemon (or vice versa); a proxy/broker delivering another request's response; custom daemon builds replying with Success instead of CapsuleMetadata.","solutions":["Align CLI and daemon versions (restart the daemon from the same release as the CLI) and retry.","Inspect the printed response variant in the error to identify the mismatch.","Check for topic/correlation-id routing bugs if you run multiple CLI sessions against one daemon."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// verify request/response schema version before sending\nif daemon_protocol_version()? != expected_protocol_version() {\n    anyhow::bail!(\"daemon/CLI protocol mismatch — restart daemon\");\n}","typeGuard":"fn as_metadata(resp: &KernelResponse) -> Option<&Vec<CapsuleEntry>> {\n    if let KernelResponse::CapsuleMetadata(e) = resp { Some(e) } else { None }\n}","tryCatchPattern":"match client.request(KernelRequest::GetCapsuleMetadata).await? {\n    KernelResponse::CapsuleMetadata(e) => Ok(e),\n    other => {\n        // debug-print variant, restart daemon on version drift\n        Err(anyhow!(\"unexpected: {other:?}\"))\n    }\n}","preventionTips":["Restart the daemon whenever the CLI is upgraded.","Match variant expectations to the daemon's protocol version.","Use correlation-id tagged topics to avoid cross-request response mixing."],"tags":["ipc","protocol","daemon"],"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"}