{"record":{"id":"1449a298fd3c21e0","repo":"astrid-runtime/astrid","slug":"unexpected-response-from-kernel-other-1449a2","errorCode":null,"errorMessage":"unexpected response from kernel: {other:?}","messagePattern":"unexpected response from kernel: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/secret.rs","lineNumber":444,"sourceCode":"/// after a successful agent-scoped delete.\nfn classify_secret_delete_response(\n    scope: EnvStorageScope,\n    body: AdminResponseBody,\n) -> Result<SecretDeleteProbe> {\n    match body {\n        AdminResponseBody::Error(msg)\n            if scope == EnvStorageScope::Shared && msg.contains(\"permission denied\") =>\n        {\n            Ok(SecretDeleteProbe::SharedUnauthorized)\n        },\n        AdminResponseBody::Error(msg) => Err(anyhow::anyhow!(\"kernel rejected request: {msg}\")),\n        AdminResponseBody::Success(value) => Ok(SecretDeleteProbe::Deleted(\n            value\n                .get(\"deleted\")\n                .and_then(serde_json::Value::as_bool)\n                .unwrap_or(false),\n        )),\n        other => anyhow::bail!(\"unexpected response from kernel: {other:?}\"),\n    }\n}\n\nasync fn run_delete(args: &DeleteArgs) -> Result<ExitCode> {\n    let principal = context::resolve_agent(args.agent.as_deref())?;\n    let capsule = validate_optional_capsule(args.capsule.as_deref())?;\n    let kind = capsule_env_kind(&capsule, &args.key)\n        .await?\n        .unwrap_or(EnvValueKind::Text);\n    let mut client = crate::admin_client::connect_as_active_agent().await?;\n    let scopes = if matches!(kind, EnvValueKind::Secret) {\n        vec![EnvStorageScope::Agent, EnvStorageScope::Shared]\n    } else {\n        vec![EnvStorageScope::Agent]\n    };\n    let mut removed = false;\n    for scope in scopes {\n        let body = client","sourceCodeStart":426,"sourceCodeEnd":462,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/secret.rs#L426-L462","documentation":"`classify_secret_delete_response` maps an EnvDelete reply to a SecretDeleteProbe, accepting `Success` (and presumably PermissionDenied) variants. Any other AdminResponseBody variant bails with this message showing the body. Callers run_delete and several tests rely on this classification.","triggerScenarios":"`astrid secret delete` (or the tests agent_permission_denial_still_fails_secret_delete / shared_validation_errors_still_fail_secret_delete) when the kernel returns a variant other than Success/PermissionDenied for the delete request — e.g. version-skewed daemon replying with a new or different body type.","commonSituations":"Daemon/CLI version mismatch after an AdminResponseBody enum change; wrong admin endpoint returning unexpected payloads; test fixtures emitting a stale response variant.","solutions":["Restart the daemon and CLI from the same build/commit.","Read the `{other:?}` payload to identify the unexpected variant and handle it explicitly in classify_secret_delete_response.","Confirm the delete request goes to the real astrid kernel admin service, not a proxy.","Update test fixtures/mocks to produce current AdminResponseBody variants."],"exampleFix":"// before\nother => anyhow::bail!(\"unexpected response from kernel: {other:?}\"),\n// after\nAdminResponseBody::Error(e) => anyhow::bail!(\"daemon delete failed: {e}\"),\nother => anyhow::bail!(\"unexpected response from kernel: {other:?}\"),","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_delete_probe_ok(body: &AdminResponseBody) -> bool {\n    matches!(body, AdminResponseBody::Success(_) | AdminResponseBody::PermissionDenied)\n}","tryCatchPattern":"match classify_secret_delete_response(body).await {\n    Ok(probe) => handle(probe),\n    Err(e) if e.to_string().contains(\"unexpected response from kernel\") => {\n        eprintln!(\"CLI/daemon mismatch? upgrade both and retry\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Run matching CLI/daemon versions; restart the daemon after updates.","Keep classify_* functions in sync with the AdminResponseBody enum.","Update test mocks whenever response variants change.","Log the raw body before bailing to speed up diagnosis."],"tags":["ipc","protocol-mismatch","unexpected-response","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"}