astrid-runtime/astrid · error
resolve capsule cache owner UID
Error message
resolve capsule cache owner UID: {error} What it means
While verifying a published capsule materialization, the kernel could not resolve the owning principal to a cache owner UID via principal_directory.uid_for(). The underlying directory error is wrapped with this prefix. Without the UID the durable package cannot be looked up under the correct StateOwner.
Solutions
- Read the wrapped inner error to see why uid_for failed (not found vs I/O)
- Register/sync the principal in the principal directory before publishing/verifying the capsule
- Repair or reinitialize the principal directory store if its backend is failing
- Retry after fixing the directory; repair_published_materialization/confirm flows will then pass
Defensive patterns
Strategy: validation
Validate before calling
let uid = principal_directory.uid_for(principal)
.map_err(|e| format!("principal {} not resolvable to cache UID: {e}", principal))?;
if uid == 0 { return Err("unresolved UID 0; register principal first"); } Try / catch
match principal_directory.uid_for(principal) {
Ok(uid) => proceed_with_verification(uid),
Err(e) => log::error!("principal {} missing from directory: {e}", principal),
} Prevention
- Ensure principals are registered in the directory before publishing capsules
- Monitor the principal directory backend health
- Include UID resolution in pre-publication validation
When it happens
Trigger: verify_published_materialization() calls principal_directory.uid_for(principal) which fails (principal unknown to the directory, directory backend error) and the result is mapped to "resolve capsule cache owner UID: {error}".
Common situations: The principal was deleted or never registered in the principal directory; the directory store is corrupted or its backend (disk/db) is failing; a stale snapshot references a principal from a previous installation.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Astrid volume is already open
- Astrid volume is not a regular file
- Astrid volume path has no file name
- Astrid volume record checksum mismatch
- audit read failed
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/ed5fc2dd054d7cfa.
Report an issue: GitHub.
Appendix: source
Thrown at crates/astrid-kernel/src/capsule_materialization.rs:21
use std::path::Path;
use super::{BoundMaterialization, Kernel, authenticated_ancestor_directories};
impl Kernel {
/// Verify every projected byte against one immutable package snapshot.
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
pub(crate) fn verify_published_materialization(
&self,
dir: &Path,
principal: &astrid_core::principal::PrincipalId,
manifest: &astrid_capsule_types::manifest::CapsuleManifest,
snapshot: &astrid_storage::CapsulePackageSnapshot,
) -> anyhow::Result<()> {
self.validate_published_cache_path(dir, principal, manifest, snapshot)?;
let uid = self
.principal_directory
.uid_for(principal)
.map_err(|error| anyhow::anyhow!("resolve capsule cache owner UID: {error}"))?;
let verified = astrid_capsule_install::read_verified_durable_package_for_owner(
self.principal_store
.as_ref()
.ok_or_else(|| anyhow::anyhow!("durable capsule registry is unavailable"))?,
&astrid_storage::StateOwner::Principal(uid),
manifest.package.name.as_str(),
)?
.ok_or_else(|| anyhow::anyhow!("materialized capsule is absent from durable registry"))?;
if verified.snapshot() != snapshot {
anyhow::bail!("materialized capsule snapshot differs from the caller's publication");
}
if verified.manifest().package.name != manifest.package.name
|| verified.manifest().package.version != manifest.package.version
{
anyhow::bail!("materialized capsule manifest differs from durable registry");
}
let manifest_bytes = Self::read_projection_file_nofollow(&dir.join("Capsule.toml"))
.map_err(|error| anyhow::anyhow!("read materialized capsule manifest: {error:#}"))?;View on GitHub (pinned to affd8760f4)