{"record":{"id":"37482a5104ef6eae","repo":"astrid-runtime/astrid","slug":"read-durable-capsule-package-id-error","errorCode":null,"errorMessage":"read durable capsule package '{id}': {error}","messagePattern":"read durable capsule package '(.+?)': (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-kernel/src/lib.rs","lineNumber":3261,"sourceCode":"    #[cfg(not(target_family = \"wasm\"))]\n    pub(crate) async fn remove_one_capsule(\n        &self,\n        id: &astrid_capsule_types::CapsuleId,\n        principal: &PrincipalId,\n    ) -> Result<bool, anyhow::Error> {\n        let store = self\n            .principal_store\n            .clone()\n            .ok_or_else(|| anyhow::anyhow!(\"authoritative principal store is unavailable\"))?;\n        let uid = self\n            .principal_directory\n            .uid_for(principal)\n            .map_err(|error| anyhow::anyhow!(\"resolve durable owner for {principal}: {error}\"))?;\n        let owner = astrid_storage::StateOwner::Principal(uid);\n        let snapshot = store\n            .capsules()\n            .get_snapshot(&owner, id.as_str())\n            .map_err(|error| anyhow::anyhow!(\"read durable capsule package '{id}': {error}\"))?;\n        if snapshot.is_none() {\n            return Ok(false);\n        }\n        // Quiesce and unload before deleting the durable package. If unload\n        // fails, the package remains authoritative and can be retried on the\n        // next request; no live runtime is left without its registry source.\n        let _ = self.unload_one_capsule(id, principal).await?;\n        let removed = match store.capsules().remove(&owner, id.as_str()) {\n            Ok(removed) => removed,\n            Err(error) => {\n                self.ensure_principal_loaded(principal).await;\n                return Err(anyhow::anyhow!(\n                    \"remove durable capsule package '{id}': {error}\"\n                ));\n            },\n        };\n        if !removed {\n            // A concurrent administrative writer won the generation race. The","sourceCodeStart":3243,"sourceCodeEnd":3279,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/lib.rs#L3243-L3279","documentation":"Thrown in `remove_one_capsule` when `store.capsules().get_snapshot(&owner, id)` returns an `Err`. This is a read failure against the durable capsule registry — the snapshot lookup that must succeed before unload/delete could not be performed, so removal aborts before touching the live runtime.","triggerScenarios":"The underlying storage backend errors while reading the capsule record: corrupted store, I/O failure, lock contention, backend unreachable, or a serialization error decoding the snapshot record for `{owner}/{id}`.","commonSituations":"Disk full or failing on the storage volume; a partially-written capsule package from a crash; storage service restart during an admin delete; schema change making an old snapshot record undecodable.","solutions":["Inspect the wrapped source error for the storage backend root cause (I/O, permissions, corruption).","Check storage backend health and disk space; retry the removal after restoring service.","If the record is corrupt, repair or clear the durable capsule package with storage-level tooling, then retry."],"exampleFix":"// before: blind retry loop\nloop { kernel.remove_one_capsule(&id, &principal).await?; }\n// after: inspect cause, back off on transient backend errors\nmatch kernel.remove_one_capsule(&id, &principal).await {\n    Ok(_) => {},\n    Err(e) if is_transient(&e) => tokio::time::sleep(BACKOFF).await,\n    Err(e) => return Err(e),\n}","handlingStrategy":"retry","validationCode":"fn store_reachable(store: &Store) -> bool { store.health_check().is_ok() }","typeGuard":null,"tryCatchPattern":"match kernel.remove_one_capsule(&id, &principal).await {\n    Err(e) if is_transient(&e) && attempts < 3 => {\n        tokio::time::sleep(backoff).await; // retry\n    },\n    other => other?,\n}","preventionTips":["Monitor disk space and storage backend health.","Avoid restarting storage services during admin windows.","Test crash recovery so partially-written capsule packages are detected."],"tags":["rust","storage","io","kernel"],"backgroundTag":"database-query-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"}