{"record":{"id":"47736e804bb1bd6a","repo":"astrid-runtime/astrid","slug":"unexpected-response-from-kernel-other-47736e","errorCode":null,"errorMessage":"unexpected response from kernel: {other:?}","messagePattern":"unexpected response from kernel: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/caps.rs","lineNumber":183,"sourceCode":"\nimpl From<AgentSummary> for CapsRecord {\n    fn from(s: AgentSummary) -> Self {\n        Self {\n            principal: s.principal.to_string(),\n            groups: s.groups,\n            grants: s.grants,\n            revokes: s.revokes,\n        }\n    }\n}\n\nasync fn fetch_summary(target: &PrincipalId) -> Result<AgentSummary> {\n    let mut client = crate::admin_client::connect_as_active_agent().await?;\n    let body = client.request(AdminRequestKind::AgentList).await?;\n    let body = into_result(body)?;\n    let agents = match body {\n        AdminResponseBody::AgentList(list) => list,\n        other => anyhow::bail!(\"unexpected response from kernel: {other:?}\"),\n    };\n    agents\n        .into_iter()\n        .find(|a| a.principal == *target)\n        .with_context(|| format!(\"agent '{target}' not found\"))\n}\n\nasync fn run_show(args: ShowArgs) -> Result<ExitCode> {\n    let target = context::resolve_agent(args.name.as_deref())?;\n    let format = ValueFormat::parse(&args.format);\n    let summary = fetch_summary(&target).await?;\n\n    if !format.is_pretty() {\n        let record: CapsRecord = summary.into();\n        emit_structured(&record, format)?;\n        return Ok(ExitCode::SUCCESS);\n    }\n","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/caps.rs#L165-L201","documentation":"In `fetch_summary` (crates/astrid-cli/src/commands/caps.rs:183), the CLI requests AdminRequestKind::AgentList and expects AdminResponseBody::AgentList back; any other variant triggers bail! with the body dump. This helper backs `caps show`, so a mismatched kernel reply prevents looking up the target agent's summary.","triggerScenarios":"The AgentList admin request resolves to a non-AgentList AdminResponseBody variant — kernel/CLI protocol version skew, kernel answering with an error or status body, or a mis-routed/interleaved admin reply.","commonSituations":"Mixed-version deployment after a kernel upgrade; admin connection to the wrong service; kernel-side change repurposing or renaming the AgentList response variant.","solutions":["Deploy matching CLI and kernel versions so the AgentList contract matches","Read the {other:?} dump in the error to identify the actual response variant","Verify connect_as_active_agent targets the kernel that implements AgentList","Check the shared protocol crate for recent AdminResponseBody changes and rebuild the CLI if needed"],"exampleFix":"// before\nlet agents = match body {\n    AdminResponseBody::AgentList(list) => list,\n    other => anyhow::bail!(\"unexpected response from kernel: {other:?}\"),\n};\n// after\nlet AdminResponseBody::AgentList(list) = body else {\n    anyhow::bail!(\"kernel returned non-AgentList body; align CLI and kernel versions\");\n};\nlet agents = list;","handlingStrategy":"type-guard","validationCode":"// Pre-flight: verify target principal format before calling fetch_summary.\nif target.as_str().is_empty() {\n    eprintln!(\"target principal is required\");\n    return Ok(ExitCode::from(64));\n}","typeGuard":"fn as_agent_list(body: AdminResponseBody) -> Option<Vec<AgentSummary>> {\n    match body {\n        AdminResponseBody::AgentList(list) => Some(list),\n        _ => None,\n    }\n}","tryCatchPattern":"match fetch_summary(&target).await {\n    Ok(summary) => use(summary),\n    Err(e) if e.to_string().contains(\"unexpected response from kernel\") => {\n        eprintln!(\"caps show failed: {e:#}\\nhint: align CLI and kernel versions\");\n        ExitCode::from(2)\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep astrid-cli and kernel on the same release before capsule operations","Verify the admin connection targets the real kernel, not a stale socket","Inspect the {other:?} dump whenever the mismatch occurs","Add a protocol version handshake to admin client connect"],"tags":["cli","ipc","protocol-mismatch","capsules"],"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"}