{"record":{"id":"0e07ee2a9124192e","repo":"astrid-runtime/astrid","slug":"unexpected-response-from-kernel-other-0e07ee","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/quota.rs","lineNumber":124,"sourceCode":"        max_memory_bytes: q.max_memory_bytes,\n        max_timeout_secs: q.max_timeout_secs,\n        max_ipc_throughput_bytes: q.max_ipc_throughput_bytes,\n        max_background_processes: q.max_background_processes,\n        max_storage_bytes: q.max_storage_bytes,\n        max_cpu_fuel_per_sec: q.max_cpu_fuel_per_sec,\n    }\n}\n\nasync fn fetch_quotas(client: &mut AdminClient, target: &PrincipalId) -> Result<Quotas> {\n    let body = client\n        .request(AdminRequestKind::QuotaGet {\n            principal: target.clone(),\n        })\n        .await?;\n    let body = into_result(body)?;\n    match body {\n        AdminResponseBody::Quotas(q) => Ok(q),\n        other => anyhow::bail!(\"unexpected response from kernel: {other:?}\"),\n    }\n}\n\nasync fn fetch_usage(client: &mut AdminClient, target: &PrincipalId) -> Result<ResourceUsage> {\n    let body = client\n        .request(AdminRequestKind::UsageGet {\n            principal: target.clone(),\n        })\n        .await?;\n    let body = into_result(body)?;\n    match body {\n        AdminResponseBody::Usage(u) => Ok(u),\n        other => anyhow::bail!(\"unexpected response from kernel: {other:?}\"),\n    }\n}\n\nasync fn run_show(args: ShowArgs) -> Result<ExitCode> {\n    if args.group.is_some() {","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/quota.rs#L106-L142","documentation":"fetch_quotas sends a quotas-get admin request to the kernel and expects AdminResponseBody::Quotas; any other reply bails with 'unexpected response from kernel'. This separates transport success from semantic success: the kernel answered, but not with the quota payload the CLI asked for.","triggerScenarios":"An AdminRequestKind quotas request for a principal returns a body other than AdminResponseBody::Quotas — e.g. an error variant, a Usage body, or a newer kernel's renamed variant — reaching `other => anyhow::bail!` in fetch_quotas.","commonSituations":"Kernel/CLI version skew (quota response schema changed); request for a principal with no quota records returning an empty/error variant; wrong admin topic or request kind wiring; kernel returning an error body instead of quotas.","solutions":["Match CLI and kernel versions so the quota response schema agrees.","Inspect the debug payload in the error to identify the actual variant returned.","Confirm the principal exists and has a quota record, or handle the empty case explicitly.","Add an explicit arm for error bodies so kernel-side failures are reported as such."],"exampleFix":"// before\nother => anyhow::bail!(\"unexpected response from kernel: {other:?}\"),\n// after\nAdminResponseBody::Error { message } => anyhow::bail!(\"kernel error: {message}\"),\nother => anyhow::bail!(\"unexpected response from kernel: {other:?}\"),","handlingStrategy":"type-guard","validationCode":"// principal must exist and have a quota record before querying quotas\nif !kernel_has_principal(client, target).await? {\n    anyhow::bail!(\"unknown principal {target}; kernel will not return Quotas\");\n}","typeGuard":"fn as_quotas(body: &AdminResponseBody) -> Option<&Quotas> {\n    match body {\n        AdminResponseBody::Quotas(q) => Some(q),\n        _ => None,\n    }\n}","tryCatchPattern":"let quotas = match fetch_quotas(client, target).await {\n    Ok(q) => q,\n    Err(e) if e.to_string().contains(\"unexpected response from kernel\") => {\n        eprintln!(\"kernel replied with an unexpected body — check kernel/CLI version skew: {e:#}\");\n        return Err(e);\n    },\n    Err(e) => return Err(e),\n};","preventionTips":["Keep the kernel and CLI schema-compatible; bump both together when AdminResponseBody changes.","Handle AdminResponseBody::Error explicitly so kernel-side failures are not reported as shape mismatches.","Verify the admin request kind/topic matches the expected response before matching bodies.","Include the debug payload in logs when this error fires to identify the returned variant fast."],"tags":["kernel","ipc","quota","response-shape","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"}