{"record":{"id":"da7f2e0f6008eedd","repo":"astrid-runtime/astrid","slug":"wasm-catalog-entry-has-no-readable-bytes-bin-has","errorCode":null,"errorMessage":"WASM catalog entry has no readable bytes: bin/{hash}.wasm","messagePattern":"WASM catalog entry has no readable bytes: bin/(.+?)\\.wasm","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-capsule-install/src/wasm.rs","lineNumber":123,"sourceCode":"/// 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()\n        .to_string();\n    anyhow::ensure!(\n        actual == expected,\n        \"installed WASM integrity check failed: expected BLAKE3 {expected}, got {actual}\"\n    );\n    Ok(actual)\n}\n","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-capsule-install/src/wasm.rs#L105-L141","documentation":"Raised when read_range succeeded but returned None (no bytes) even though the descriptor exists: the catalog entry bin/{hash}.wasm has metadata but zero readable content. read_catalog_wasm surfaces this so catalog_wasm_hash fails loudly instead of hashing empty bytes.","triggerScenarios":"catalog_wasm_hash -> read_catalog_wasm: describe() returns a descriptor, read_range(&StateOwner::System, &name, 0, descriptor.logical_bytes()) completes with Ok(None) — the entry exists in the index but holds no readable bytes.","commonSituations":"Interrupted streaming ingest that recorded the descriptor but not the data; empty/truncated blob files after a crash; storage backend returning empty reads silently (misbehaving custom backend); zero-byte WASM file published.","solutions":["Re-run the install so put_streaming_batch republishes the full WASM bytes into the catalog","Check the WASM source file is non-empty before install (a 0-byte artifact produces an empty entry)","Repair or reinitialize a corrupted content store and republish all catalog entries","If using a custom content store, fix read_range so it returns an error rather than None for readable-data loss"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// reject empty artifacts before publishing\nif wasm_bytes.is_empty() {\n    anyhow::bail!(\"refusing to publish 0-byte WASM artifact\");\n}","typeGuard":null,"tryCatchPattern":"match catalog_wasm_hash(&storage, &expected) {\n    Err(e) if e.to_string().contains(\"no readable bytes\") => {\n        // entry exists but is empty: force a full republish\n        storage.content().delete(&StateOwner::System, &name)?;\n        republish_wasm(&storage, &source_bytes)?;\n        catalog_wasm_hash(&storage, &expected)\n    }\n    other => other,\n}","preventionTips":["Validate the source .wasm is non-empty before install","Never kill an install during put_streaming_batch; crash-safety requires a clean republish","Test custom content-store backends to ensure they never return Ok(None) for existing descriptors"],"tags":["rust","storage","wasm","content-catalog","empty-data"],"backgroundTag":"empty-result-set","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"}