astrid-runtime/astrid · error
unexpected daemon metadata response: {other:?}
Error message
unexpected daemon metadata response: {other:?} What it means
`capsule_env_kind` asks the daemon for capsule metadata via `KernelRequest::GetCapsuleMetadata` and pattern-matches the reply. If the daemon returns any `KernelResponse` variant other than `CapsuleMetadata` or `Error`, this bail fires with the unexpected value debug-printed. It is a protocol-mismatch guard between CLI and daemon, usually meaning a version skew or an in-flight kernel change.
Source
Thrown at crates/astrid-cli/src/commands/secret.rs:276
.to_owned(),
)
.context("invalid capsule name")
}
/// Resolve one capsule's non-secret schema through the authenticated daemon
/// inventory. The CLI must not inspect a materialized `Capsule.toml` under a
/// principal home: the registry snapshot is the authority for installed
/// capsule metadata, while workspace capsules are only visible through the
/// explicit workspace inventory.
async fn capsule_env_kind(capsule: &CapsuleId, key: &str) -> Result<Option<EnvValueKind>> {
let mut client = crate::socket_client::connect_kernel_for_workspace(None).await?;
let response = client.request(KernelRequest::GetCapsuleMetadata).await?;
let entries = match response {
astrid_core::kernel_api::KernelResponse::CapsuleMetadata(entries) => entries,
astrid_core::kernel_api::KernelResponse::Error(error) => {
anyhow::bail!("daemon metadata lookup failed: {error}");
},
other => anyhow::bail!("unexpected daemon metadata response: {other:?}"),
};
Ok(entries
.into_iter()
.find(|entry| entry.name == capsule.as_str())
.and_then(|entry| {
entry.env.get(key).map(|field| {
if field.env_type.eq_ignore_ascii_case("secret") {
EnvValueKind::Secret
} else {
EnvValueKind::Text
}
})
}))
}
async fn run_set(args: &SetArgs) -> Result<ExitCode> {
if args.key.is_empty() {
anyhow::bail!("invalid key: must not be empty");View on GitHub (pinned to affd8760f4)
Solutions
- Restart the daemon so it matches the installed CLI version (rebuild both from the same commit).
- Check which socket/endpoint the admin client connects to; make sure it is the astrid kernel, not another service.
- Add the new KernelResponse variant to the match in capsule_env_kind if the protocol intentionally changed.
- Capture the `{other:?}` payload and file an issue if the variant looks like a legitimate kernel response.
Example fix
// before
other => anyhow::bail!("unexpected daemon metadata response: {other:?}"),
// after
other => anyhow::bail!("unexpected daemon metadata response: {other:?}; CLI/daemon version mismatch? update both to the same build"), Defensive patterns
Strategy: try-catch
Type guard
fn is_capsule_metadata(resp: &KernelResponse) -> bool { matches!(resp, KernelResponse::CapsuleMetadata(_)) } Try / catch
match client.request(KernelRequest::GetCapsuleMetadata).await? {
KernelResponse::CapsuleMetadata(entries) => entries,
KernelResponse::Error(e) => bail!("daemon metadata lookup failed: {e}"),
other => { log::warn!("unexpected kernel response: {other:?}"); bail!("unexpected daemon metadata response — check CLI/daemon versions"); }
} Prevention
- Keep CLI and daemon built from the same commit/version.
- Restart the daemon after upgrading the CLI.
- Pin the daemon socket path so you never talk to the wrong service.
- On KernelResponse enum changes, update every match site and add a compile-exhaustiveness test.
When it happens
Trigger: Calling `astrid secret set` or `astrid secret delete` (via run_set/run_delete) when the daemon answers GetCapsuleMetadata with an unexpected variant (e.g. a newer/older daemon returning a different response type, or a stub/test kernel replying with something else).
Common situations: Daemon and CLI built from different commits after a KernelResponse enum change; connecting to the wrong socket/port where a non-astrid service answers; a kernel that replies with a placeholder variant for unimplemented requests.
Related errors
- unexpected response from kernel: {body:?}
- unexpected response from kernel: {other:?}
- daemon returned an unexpected status response
- 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/5658b687aa2d5ee3.
Report an issue: GitHub.