astrid-runtime/astrid · error
unexpected daemon response: {other:?}
Error message
unexpected daemon response: {other:?} What it means
dispatch_capsule_remove handles the daemon's response to a capsule removal request. It only expects a success variant (printing "Removed '<name>'") or KernelResponse::Error; any other KernelResponse variant falls into this catch-all bail, meaning the daemon answered with a response type the CLI did not anticipate for this operation.
Source
Thrown at crates/astrid-cli/src/dispatch.rs:469
astrid_core::kernel_api::KernelResponse::Success(_) => {
if purge {
let principal = crate::principal::current();
let entries =
commands::capsule::install_headless::list_env_entries(&principal, &name)?;
for entry in entries {
if matches!(entry.scope, astrid_core::kernel_api::EnvStorageScope::Agent) {
commands::capsule::install_headless::delete_env_entry(
&principal, &name, &entry.key, entry.kind,
)?;
}
}
}
eprintln!("Removed '{name}'.");
},
astrid_core::kernel_api::KernelResponse::Error(message) => {
anyhow::bail!("daemon rejected capsule removal: {message}");
},
other => anyhow::bail!("unexpected daemon response: {other:?}"),
}
Ok(ExitCode::SUCCESS)
}
async fn dispatch_mcp(command: McpCommands) -> Result<ExitCode> {
if !matches!(command, McpCommands::Gc) {
commands::daemon::validate_runtime_admission()?;
}
match command {
McpCommands::Serve {
workspace,
request_timeout: _,
} => commands::mcp::serve(None, workspace.as_deref()).await,
McpCommands::Attach { workspace } => {
commands::mcp::attach(None, workspace.as_deref()).await
},
McpCommands::Gateway => commands::mcp::gateway(None).await,
McpCommands::Ready { format } => commands::mcp::ready(None, &format).await,View on GitHub (pinned to affd8760f4)
Solutions
- Ensure the CLI and daemon are built from the same version (`astrid --version`, restart the daemon).
- Inspect the debug payload in the message to identify which KernelResponse variant was returned and report/match it.
- Add an explicit match arm for the unexpected variant in dispatch_capsule_remove, or update the astrid-core protocol types.
- Restart the daemon and retry the removal to rule out a transient misrouted response.
Example fix
// before
other => anyhow::bail!("unexpected daemon response: {other:?}"),
// after
KernelResponse::NotFound(msg) => anyhow::bail!("capsule not found: {msg}"),
other => anyhow::bail!("unexpected daemon response: {other:?}"), Defensive patterns
Strategy: try-catch
Validate before calling
let status = std::process::Command::new("astrid").args(["--version"]).output()?;
let cli_v = String::from_utf8_lossy(&status.stdout);
// ensure daemon version matches cli_v before issuing capsule remove Type guard
fn is_expected_response(r: &KernelResponse) -> bool {
matches!(r, KernelResponse::Ok(_)) || matches!(r, KernelResponse::Error(_))
} Try / catch
match dispatch_capsule_remove(cmd) {
Ok(code) => code,
Err(e) if e.to_string().starts_with("unexpected daemon response") => {
eprintln!("CLI/daemon protocol mismatch: {e:#}; restart daemon or upgrade CLI");
ExitCode::FAILURE
}
Err(e) => { eprintln!("{e:#}"); ExitCode::FAILURE }
} Prevention
- Keep CLI and daemon installed from the same build/version.
- Restart the daemon after upgrading astrid-core.
- Match every KernelResponse variant you care about explicitly and keep the catch-all last.
- Log the full debug payload ({other:?}) when reporting bugs.
When it happens
Trigger: Calling `astrid capsule remove` when the daemon replies with a KernelResponse variant other than the removal-success or Error variant — e.g. a protocol mismatch where the CLI binary and daemon are different versions, or the daemon misroutes another command's response to this request.
Common situations: Running an older CLI against a newer daemon (or vice versa) after a protocol change; a buggy daemon returning a wrong variant; concurrent requests whose responses are crossed.
Related errors
- Daemon returned an unexpected response to GetCommands
- unexpected response from kernel: {other:?}
- unexpected response from kernel: {body:?}
- unexpected response from kernel: {other:?}
- unexpected daemon metadata response: {other:?}
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/84a2dab0f4f540aa.
Report an issue: GitHub.