astrid-runtime/astrid · error
unexpected response from kernel: {other:?}
Error message
unexpected response from kernel: {other:?} What it means
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.
Source
Thrown at crates/astrid-cli/src/commands/quota.rs:124
max_memory_bytes: q.max_memory_bytes,
max_timeout_secs: q.max_timeout_secs,
max_ipc_throughput_bytes: q.max_ipc_throughput_bytes,
max_background_processes: q.max_background_processes,
max_storage_bytes: q.max_storage_bytes,
max_cpu_fuel_per_sec: q.max_cpu_fuel_per_sec,
}
}
async fn fetch_quotas(client: &mut AdminClient, target: &PrincipalId) -> Result<Quotas> {
let body = client
.request(AdminRequestKind::QuotaGet {
principal: target.clone(),
})
.await?;
let body = into_result(body)?;
match body {
AdminResponseBody::Quotas(q) => Ok(q),
other => anyhow::bail!("unexpected response from kernel: {other:?}"),
}
}
async fn fetch_usage(client: &mut AdminClient, target: &PrincipalId) -> Result<ResourceUsage> {
let body = client
.request(AdminRequestKind::UsageGet {
principal: target.clone(),
})
.await?;
let body = into_result(body)?;
match body {
AdminResponseBody::Usage(u) => Ok(u),
other => anyhow::bail!("unexpected response from kernel: {other:?}"),
}
}
async fn run_show(args: ShowArgs) -> Result<ExitCode> {
if args.group.is_some() {View on GitHub (pinned to affd8760f4)
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.
Example fix
// before
other => anyhow::bail!("unexpected response from kernel: {other:?}"),
// after
AdminResponseBody::Error { message } => anyhow::bail!("kernel error: {message}"),
other => anyhow::bail!("unexpected response from kernel: {other:?}"), Defensive patterns
Strategy: type-guard
Validate before calling
// principal must exist and have a quota record before querying quotas
if !kernel_has_principal(client, target).await? {
anyhow::bail!("unknown principal {target}; kernel will not return Quotas");
} Type guard
fn as_quotas(body: &AdminResponseBody) -> Option<&Quotas> {
match body {
AdminResponseBody::Quotas(q) => Some(q),
_ => None,
}
} Try / catch
let quotas = match fetch_quotas(client, target).await {
Ok(q) => q,
Err(e) if e.to_string().contains("unexpected response from kernel") => {
eprintln!("kernel replied with an unexpected body — check kernel/CLI version skew: {e:#}");
return Err(e);
},
Err(e) => return Err(e),
}; Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- unexpected response shape: {other:?}
- kernel refused storage mount: {error}
- unexpected response shape: {other:?}
- unexpected response from kernel: {other:?}
- unexpected response from kernel: {other:?}
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/0e07ee2a9124192e.
Report an issue: GitHub.