astrid-runtime/astrid · error
unexpected daemon response: {other:?}
Error message
unexpected daemon response: {other:?} What it means
Raised by `daemon_capsule_metadata` when the daemon replies to `GetCapsuleMetadata` with neither `CapsuleMetadata` nor `Error` — i.e. an unexpected `KernelResponse` variant. This indicates a protocol mismatch between CLI and daemon: the response does not fit the expected request/response contract, so it is dumped with `{other:?}` debug formatting.
Source
Thrown at crates/astrid-cli/src/commands/capsule/install_update.rs:180
workspace,
false,
approve_untrusted,
&[],
)
.await
} else {
update_all_capsules(&home, &principal, workspace, approve_untrusted).await
}
}
async fn daemon_capsule_metadata() -> anyhow::Result<Vec<CapsuleMetadataEntry>> {
let mut client = crate::socket_client::connect_kernel_for_workspace(None).await?;
match client.request(KernelRequest::GetCapsuleMetadata).await? {
KernelResponse::CapsuleMetadata(entries) => Ok(entries),
KernelResponse::Error(message) => {
bail!("daemon rejected capsule metadata request: {message}")
},
other => bail!("unexpected daemon response: {other:?}"),
}
}
async fn update_daemon_capsules(
target: Option<&str>,
principal: &astrid_core::PrincipalId,
approve_untrusted: bool,
) -> anyhow::Result<()> {
let entries = daemon_capsule_metadata().await?;
if let Some(name) = target {
let entry = entries
.into_iter()
.find(|entry| entry.name == name)
.ok_or_else(|| anyhow::anyhow!("Capsule '{name}' is not installed."))?;
let Some(source) = entry.update_source else {
eprintln!(
"Capsule '{name}' has no remotely updateable source; its durable package is unchanged."
);View on GitHub (pinned to affd8760f4)
Solutions
- Restart the daemon so it matches the CLI's protocol version, then retry.
- Check versions: update the daemon (`astrid daemon` upgrade/reinstall) after any CLI upgrade.
- Inspect the debug payload in the message (`{other:?}`) to identify which variant was returned and why.
- Remove stale socket files / ensure only one daemon instance is running for the workspace.
Example fix
// before: old daemon answers new CLI's request with a legacy payload
astrid capsule update
// error: unexpected daemon response: Success({...})
// after
astrid daemon restart # run the upgraded daemon binary
astrid capsule update Defensive patterns
Strategy: try-catch
Type guard
fn is_capsule_metadata(resp: &KernelResponse) -> Option<&Vec<CapsuleMetadataEntry>> {
match resp {
KernelResponse::CapsuleMetadata(entries) => Some(entries),
_ => None,
}
} Try / catch
match daemon_capsule_metadata().await {
Ok(entries) => use_entries(entries),
Err(e) if e.to_string().starts_with("unexpected daemon response") => {
eprintln!("{e:#}\nProtocol mismatch - restart/upgrade the daemon.");
std::process::exit(1);
},
Err(e) => return Err(e),
} Prevention
- Keep daemon and CLI versions locked in step; restart the daemon after every CLI upgrade.
- Remove stale socket files so requests cannot reach an outdated daemon process.
- Run a single daemon instance per workspace.
- Log unexpected KernelResponse payloads to spot protocol drift early.
When it happens
Trigger: Running `astrid capsule update` or distro-lock regeneration against a daemon whose response to GetCapsuleMetadata is a different KernelResponse variant — typically a daemon/CLI version skew where the old daemon answers a newer request type with a generic Success/other payload, or a proxy/misrouted socket reply.
Common situations: CLI upgraded but daemon still running an older binary (socket not restarted); multiple daemons or a stale socket file routing requests to the wrong process; custom/patched daemon builds with divergent response types.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- unexpected daemon response: {other:?}
- running daemon returned unknown unload status {other:?}
- running daemon returned unload success without a status
- unexpected daemon response: {other:?}
- daemon returned an unexpected status response: {other:?}
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/7affcd60f40f0156.
Report an issue: GitHub.