{"record":{"id":"5658b687aa2d5ee3","repo":"astrid-runtime/astrid","slug":"unexpected-daemon-metadata-response-other-5658b6","errorCode":null,"errorMessage":"unexpected daemon metadata response: {other:?}","messagePattern":"unexpected daemon metadata response: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/secret.rs","lineNumber":276,"sourceCode":"            .to_owned(),\n    )\n    .context(\"invalid capsule name\")\n}\n\n/// Resolve one capsule's non-secret schema through the authenticated daemon\n/// inventory. The CLI must not inspect a materialized `Capsule.toml` under a\n/// principal home: the registry snapshot is the authority for installed\n/// capsule metadata, while workspace capsules are only visible through the\n/// explicit workspace inventory.\nasync fn capsule_env_kind(capsule: &CapsuleId, key: &str) -> Result<Option<EnvValueKind>> {\n    let mut client = crate::socket_client::connect_kernel_for_workspace(None).await?;\n    let response = client.request(KernelRequest::GetCapsuleMetadata).await?;\n    let entries = match response {\n        astrid_core::kernel_api::KernelResponse::CapsuleMetadata(entries) => entries,\n        astrid_core::kernel_api::KernelResponse::Error(error) => {\n            anyhow::bail!(\"daemon metadata lookup failed: {error}\");\n        },\n        other => anyhow::bail!(\"unexpected daemon metadata response: {other:?}\"),\n    };\n    Ok(entries\n        .into_iter()\n        .find(|entry| entry.name == capsule.as_str())\n        .and_then(|entry| {\n            entry.env.get(key).map(|field| {\n                if field.env_type.eq_ignore_ascii_case(\"secret\") {\n                    EnvValueKind::Secret\n                } else {\n                    EnvValueKind::Text\n                }\n            })\n        }))\n}\n\nasync fn run_set(args: &SetArgs) -> Result<ExitCode> {\n    if args.key.is_empty() {\n        anyhow::bail!(\"invalid key: must not be empty\");","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/secret.rs#L258-L294","documentation":"`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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\nother => anyhow::bail!(\"unexpected daemon metadata response: {other:?}\"),\n// after\nother => anyhow::bail!(\"unexpected daemon metadata response: {other:?}; CLI/daemon version mismatch? update both to the same build\"),","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_capsule_metadata(resp: &KernelResponse) -> bool { matches!(resp, KernelResponse::CapsuleMetadata(_)) }","tryCatchPattern":"match client.request(KernelRequest::GetCapsuleMetadata).await? {\n    KernelResponse::CapsuleMetadata(entries) => entries,\n    KernelResponse::Error(e) => bail!(\"daemon metadata lookup failed: {e}\"),\n    other => { log::warn!(\"unexpected kernel response: {other:?}\"); bail!(\"unexpected daemon metadata response — check CLI/daemon versions\"); }\n}","preventionTips":["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."],"tags":["ipc","protocol-mismatch","version-skew","rust"],"backgroundTag":"unexpected-response-shape","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}