astrid-runtime/astrid · error

unexpected response from kernel: {other:?}

Error message

unexpected response from kernel: {other:?}

What it means

fetch_groups sends a GroupList admin request to the kernel and expects the response body to be AdminResponseBody::GroupList. Any other response variant is a protocol mismatch, so the CLI bails with a debug dump of the unexpected response instead of misinterpreting it.

Source

Thrown at crates/astrid-cli/src/commands/group.rs:105

/// Top-level dispatcher for `astrid group`.
pub(crate) async fn run(cmd: GroupCommand) -> Result<ExitCode> {
    match cmd {
        GroupCommand::Create(args) => run_create(args).await,
        GroupCommand::Show(args) => run_show(args).await,
        GroupCommand::List(args) => run_list(args).await,
        GroupCommand::Delete(args) => run_delete(args).await,
        GroupCommand::Modify(args) => run_modify(args).await,
    }
}

async fn fetch_groups() -> Result<Vec<GroupSummary>> {
    let mut client = crate::admin_client::connect_as_active_agent().await?;
    let body = client.request(AdminRequestKind::GroupList).await?;
    let body = into_result(body)?;
    match body {
        AdminResponseBody::GroupList(list) => Ok(list),
        other => anyhow::bail!("unexpected response from kernel: {other:?}"),
    }
}

async fn run_create(args: CreateArgs) -> Result<ExitCode> {
    if args.caps.is_empty() {
        eprintln!("astrid: --caps is required (use comma-separated values)");
        return Ok(ExitCode::from(1));
    }
    let mut client = crate::admin_client::connect_as_active_agent().await?;
    let body = client
        .request(AdminRequestKind::GroupCreate {
            name: args.name.clone(),
            capabilities: args.caps,
            description: args.description,
            unsafe_admin: args.unsafe_admin,
        })
        .await?;
    let _ = into_result(body)?;

View on GitHub (pinned to affd8760f4)

Solutions

  1. Check CLI and kernel versions match (`astrid --version` vs the daemon's version) and upgrade the mismatched component.
  2. Restart the kernel daemon to rule out stale state.
  3. Inspect the dumped `other` payload in the message to identify which variant was returned and report/update accordingly.

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

// Check version compatibility before issuing admin requests:
let cli_ver = env!("CARGO_PKG_VERSION");
let kernel_ver = client.version().await?;
if !versions_compatible(cli_ver, &kernel_ver) {
    eprintln!("CLI {cli_ver} incompatible with kernel {kernel_ver}");
}

Type guard

fn as_group_list(body: &AdminResponseBody) -> Option<&Vec<GroupSummary>> {
    match body {
        AdminResponseBody::GroupList(l) => Some(l),
        _ => None,
    }
}

Try / catch

match body {
    AdminResponseBody::GroupList(list) => Ok(list),
    other => {
        tracing::error!("GroupList mismatch: {other:?}");
        anyhow::bail!("unexpected response from kernel: {other:?}")
    }
}

Prevention

When it happens

Trigger: Calling `astrid group show` or `astrid group list` when the connected kernel replies to GroupList with a different AdminResponseBody variant — typically due to a CLI/kernel version skew or a routing bug in the admin protocol.

Common situations: Running a newer/older CLI against a mismatched kernel daemon; a proxy or misconfigured admin socket returning error bodies where typed responses are expected; kernel code changed a response shape without the CLI being updated.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/07e0b3a0a51b71ad. Report an issue: GitHub.