astrid-runtime/astrid · error
unexpected response from kernel: {other:?}
Error message
unexpected response from kernel: {other:?} What it means
In `run_stats` (crates/astrid-cli/src/commands/audit.rs:85), the CLI sends AdminRequestKind::AuditStats and pattern-matches the reply expecting AdminResponseBody::AuditStats. A different variant aborts with bail!. The guard keeps the stats command from operating on a body that lacks the audit statistics fields.
Source
Thrown at crates/astrid-cli/src/commands/audit.rs:85
struct AuditStatsOutput {
stats: AuditStats,
health: AuditHealth,
}
/// Dispatch an audit operator command through the kernel admin RPC.
pub(crate) async fn run(args: &AuditArgs) -> Result<ExitCode> {
match &args.command {
AuditCommand::Stats(args) => run_stats(args).await,
AuditCommand::Prune(args) => run_prune(args).await,
AuditCommand::Health(args) => run_health(args).await,
}
}
async fn run_stats(args: &AuditStatsArgs) -> Result<ExitCode> {
let mut client = connect_as_active_agent().await?;
let stats = match into_result(client.request(AdminRequestKind::AuditStats).await?)? {
AdminResponseBody::AuditStats(stats) => stats,
other => bail!("unexpected response from kernel: {other:?}"),
};
let health = match into_result(client.request(AdminRequestKind::AuditHealth).await?)? {
AdminResponseBody::AuditHealth(health) => health,
other => bail!("unexpected response from kernel: {other:?}"),
};
let degraded = stats.degraded || health.degraded;
let format = ValueFormat::parse(&args.format);
if format.is_pretty() {
print_stats_pretty(&stats, &health);
} else {
emit_structured(&AuditStatsOutput { stats, health }, format)?;
}
Ok(if degraded {
ExitCode::from(2)
} else {
ExitCode::SUCCESS
})
}View on GitHub (pinned to affd8760f4)
Solutions
- Match CLI and kernel versions so AuditStats response shape agrees on both sides
- Read the {other:?} variant in the error message to identify the actual body
- Verify the audit subsystem is enabled in the kernel configuration
- Confirm the admin client connects to the kernel implementing AdminRequestKind::AuditStats
Example fix
// before
let stats = match into_result(client.request(AdminRequestKind::AuditStats).await?)? {
AdminResponseBody::AuditStats(stats) => stats,
other => bail!("unexpected response from kernel: {other:?}"),
};
// after
let stats = match into_result(client.request(AdminRequestKind::AuditStats).await?)? {
AdminResponseBody::AuditStats(stats) => stats,
other => bail!(
"unexpected response from kernel (expected AuditStats, got {other:?}); \
check CLI/kernel version match"
),
}; Defensive patterns
Strategy: type-guard
Validate before calling
// Confirm audit support exists before querying: kernel version/capability check. // e.g. ensure kernel >= version_with_audit_support before sending AdminRequestKind::AuditStats
Type guard
fn as_audit_stats(body: AdminResponseBody) -> Option<AuditStats> {
match body {
AdminResponseBody::AuditStats(s) => Some(s),
_ => None,
}
} Try / catch
match run_stats(&args).await {
Ok(code) => code,
Err(e) if e.to_string().contains("unexpected response from kernel") => {
eprintln!("audit stats unavailable: {e:#}");
ExitCode::from(2)
}
Err(e) => return Err(e),
} Prevention
- Verify the kernel build has the audit subsystem enabled before using audit commands
- Keep CLI and kernel on the same version
- Capture the {other:?} variant dump in logs for post-mortem
- Query AuditHealth first as a capability probe for audit support
When it happens
Trigger: The AuditStats admin request returns a non-AuditStats AdminResponseBody variant — kernel/CLI protocol skew, kernel answering with an error or status body, or a mis-routed admin reply.
Common situations: Audit subsystem disabled or reshaped in a newer kernel while the CLI expects AuditStats; admin socket connected to a service that does not implement AuditStats; version-mismatched deployment.
Related errors
- unexpected response from kernel: {body:?}
- unexpected response from kernel: {other:?}
- Daemon returned an unexpected response to GetCommands
- unexpected daemon response: {other:?}
- unexpected response from kernel: {other:?}
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/be96c7aa447107b0.
Report an issue: GitHub.