{"record":{"id":"8b98f63f357725ba","repo":"astrid-runtime/astrid","slug":"daemon-metadata-lookup-failed-error","errorCode":null,"errorMessage":"daemon metadata lookup failed: {error}","messagePattern":"daemon metadata lookup failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/capsule/deps.rs","lineNumber":155,"sourceCode":"}\n\n// ---------------------------------------------------------------------------\n// Display\n// ---------------------------------------------------------------------------\n\n/// Show the capsule dependency tree (imports/exports graph).\npub(crate) async fn show_tree() -> anyhow::Result<()> {\n    let mut client = crate::socket_client::connect_kernel_for_workspace(None).await?;\n    let capsules = match client.request(KernelRequest::GetCapsuleMetadata).await? {\n        KernelResponse::CapsuleMetadata(entries) => entries\n            .into_iter()\n            .map(|entry| CapsuleDependencyMetadata {\n                name: entry.name,\n                imports: entry.imports,\n                exports: entry.exports,\n            })\n            .collect::<Vec<_>>(),\n        KernelResponse::Error(error) => bail!(\"daemon metadata lookup failed: {error}\"),\n        other => bail!(\"unexpected daemon metadata response: {other:?}\"),\n    };\n\n    if capsules.is_empty() {\n        println!(\"{}\", Theme::info(\"No capsules installed.\"));\n        return Ok(());\n    }\n\n    let (all_trees, unsatisfied) = build_dep_graph(&capsules);\n\n    for (i, tree) in all_trees.iter().enumerate() {\n        if i > 0 {\n            println!();\n        }\n\n        println!(\"{}\", tree.name.bold());\n\n        // Show exports.","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/capsule/deps.rs#L137-L173","documentation":"`show_tree` queries the daemon for capsule dependency metadata and expects a `KernelResponse` carrying capsule entries. When the daemon explicitly answers with a `KernelResponse::Error`, the inner error text is re-wrapped as `daemon metadata lookup failed: {error}`. The daemon was reachable and understood the request, but the lookup itself failed on its side.","triggerScenarios":"Calling the metadata request from show_tree (crates/astrid-cli/src/commands/capsule/deps.rs) when the kernel responds with `KernelResponse::Error` — e.g. its metadata store is unavailable, a capsule record is corrupt, or the daemon refused the query internally.","commonSituations":"Kernel daemon degraded after a crash or partial migration; a capsule installed with missing metadata; daemon version handling the metadata request differently; permissions problems on the daemon's state directory.","solutions":["Read the wrapped `{error}` text after the colon — it is the daemon's own failure reason and points to the root cause.","Restart the kernel daemon and retry.","Check daemon logs for the underlying metadata lookup failure.","Reinstall the affected capsule if its metadata record is corrupt."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure the daemon is healthy and reachable before the metadata request\nlet health = client.ping().await?;\nif !health.healthy { return Err(anyhow::anyhow!(\"daemon unhealthy: {}\", health.detail)); }","typeGuard":"fn take_metadata(resp: KernelResponse) -> Result<Vec<CapsuleMetadata>, String> {\n    match resp {\n        KernelResponse::Metadata(m) => Ok(m),\n        KernelResponse::Error(e) => Err(e),\n        other => Err(format!(\"unexpected variant: {other:?}\")),\n    }\n}","tryCatchPattern":"match daemon.request(MetadataQuery).await {\n    Ok(KernelResponse::Metadata(m)) => show(m),\n    Ok(KernelResponse::Error(e)) => {\n        eprintln!(\"daemon metadata lookup failed: {e}\");\n        eprintln!(\"check daemon logs; restarting the kernel often clears this\");\n    }\n    Ok(other) => eprintln!(\"unexpected daemon response: {other:?}\"),\n    Err(e) => eprintln!(\"daemon unreachable: {e:#}\"),\n}","preventionTips":["Read the inner daemon error after the colon — it names the real cause.","Monitor daemon health and restart after crashes or failed upgrades.","Keep daemon state directories writable and on healthy storage.","Reinstall capsules whose metadata records look corrupt."],"tags":["daemon","ipc","metadata","rpc"],"backgroundTag":"api-error-response","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"}