{"record":{"id":"fcad0b6a37ec1a36","repo":"astrid-runtime/astrid","slug":"describe-wasm-in-system-catalog","errorCode":null,"errorMessage":"describe WASM in system catalog","messagePattern":"describe WASM in system catalog","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-capsule-install/src/wasm.rs","lineNumber":115,"sourceCode":"                },\n            }\n        }\n    }\n\n    Ok(Some(WasmAddressed { hash, bytes }))\n}\n\n/// Read one verified executable from the system-owned content catalog.\npub(crate) fn read_catalog_wasm(\n    storage: &RuntimePrincipalStore,\n    hash: &str,\n) -> anyhow::Result<Vec<u8>> {\n    let name = ContentName::new(format!(\"bin/{hash}.wasm\"))\n        .context(\"construct system WASM catalog name\")?;\n    let descriptor = storage\n        .content()\n        .describe(&StateOwner::System, &name)\n        .map_err(|error| anyhow::anyhow!(error))\n        .context(\"describe WASM in system catalog\")?\n        .ok_or_else(|| anyhow::anyhow!(\"WASM catalog entry is missing: bin/{hash}.wasm\"))?;\n    storage\n        .content()\n        .read_range(&StateOwner::System, &name, 0, descriptor.logical_bytes())\n        .map_err(|error| anyhow::anyhow!(error))\n        .context(\"read WASM from system catalog\")?\n        .ok_or_else(|| anyhow::anyhow!(\"WASM catalog entry has no readable bytes: bin/{hash}.wasm\"))\n}\n\n/// Verify that the system catalog entry for `expected` exists and hashes to\n/// its content-addressed name.\npub fn catalog_wasm_hash(\n    storage: &RuntimePrincipalStore,\n    expected: &str,\n) -> anyhow::Result<String> {\n    let actual = blake3::hash(&read_catalog_wasm(storage, expected)?)\n        .to_hex()","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-capsule-install/src/wasm.rs#L97-L133","documentation":"Wraps a storage error from content().describe() when read_catalog_wasm looks up a content-addressed WASM entry (bin/{hash}.wasm) in the system catalog. A descriptor lookup that errors (as opposed to returning None) means the catalog backend itself failed, not that the entry is absent — absence yields the separate 'catalog entry is missing' error.","triggerScenarios":"catalog_wasm_hash -> read_catalog_wasm calls storage.content().describe(&StateOwner::System, &name) and the call returns Err, converted via map_err + context.","commonSituations":"Corrupted or locked content-store index; permission errors reading catalog metadata; storage backend outage; mismatched storage version after an upgrade migrating catalog formats.","solutions":["Read the wrapped source error in the anyhow chain for the actual backend failure","Check filesystem permissions and health of the system content catalog directory","If a storage-version upgrade happened, re-publish the WASM (install again) so catalog metadata is regenerated","Retry after confirming the store backend is up"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// probe catalog health before reads\nstorage.content().describe(&StateOwner::System, &probe_name)\n    .map_err(|e| format!(\"catalog backend unhealthy: {e}\"))?;","typeGuard":null,"tryCatchPattern":"match catalog_wasm_hash(&storage, &expected) {\n    Err(e) if e.chain().any(|c| c.to_string().contains(\"describe WASM in system catalog\")) => {\n        // backend failure, not a missing entry: surface the source error and retry after repair\n        repair_catalog_index()?;\n        catalog_wasm_hash(&storage, &expected)\n    }\n    other => other,\n}","preventionTips":["Distinguish backend errors from missing entries (describe()==Err vs None) when handling","Repair/rebuild the catalog index after storage upgrades","Check filesystem permissions on catalog metadata before running tools"],"tags":["rust","storage","wasm","content-catalog"],"backgroundTag":"file-read-failed","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"}