astrid-runtime/astrid · error
resolve durable owner for {principal}: {error}
Error message
resolve durable owner for {principal}: {error} What it means
Thrown in `remove_one_capsule` when `principal_directory.uid_for(principal)` fails, i.e. the principal cannot be mapped to a durable owner UID. The kernel needs this mapping to locate the capsule package under the right `StateOwner::Principal(uid)` in the store; without it removal cannot proceed safely.
Source
Thrown at crates/astrid-kernel/src/lib.rs:3256
///
/// # Errors
///
/// Returns an error when the durable store or owner mapping is unavailable,
/// the registry mutation fails, or the live view cannot be unloaded.
#[cfg(not(target_family = "wasm"))]
pub(crate) async fn remove_one_capsule(
&self,
id: &astrid_capsule_types::CapsuleId,
principal: &PrincipalId,
) -> Result<bool, anyhow::Error> {
let store = self
.principal_store
.clone()
.ok_or_else(|| anyhow::anyhow!("authoritative principal store is unavailable"))?;
let uid = self
.principal_directory
.uid_for(principal)
.map_err(|error| anyhow::anyhow!("resolve durable owner for {principal}: {error}"))?;
let owner = astrid_storage::StateOwner::Principal(uid);
let snapshot = store
.capsules()
.get_snapshot(&owner, id.as_str())
.map_err(|error| anyhow::anyhow!("read durable capsule package '{id}': {error}"))?;
if snapshot.is_none() {
return Ok(false);
}
// Quiesce and unload before deleting the durable package. If unload
// fails, the package remains authoritative and can be retried on the
// next request; no live runtime is left without its registry source.
let _ = self.unload_one_capsule(id, principal).await?;
let removed = match store.capsules().remove(&owner, id.as_str()) {
Ok(removed) => removed,
Err(error) => {
self.ensure_principal_loaded(principal).await;
return Err(anyhow::anyhow!(
"remove durable capsule package '{id}': {error}"View on GitHub (pinned to affd8760f4)
Solutions
- Verify the principal exists and is registered in the principal directory before attempting removal.
- Check directory backend connectivity/health; retry once connectivity is restored.
- Re-sync or rebuild the principal directory mapping if identities were migrated.
Example fix
// before: assume principal resolvable
kernel.remove_one_capsule(&id, &principal).await?;
// after: verify mapping first
if principal_directory.uid_for(&principal).is_err() {
anyhow::bail!("principal {principal} is not registered; cannot remove capsule");
}
kernel.remove_one_capsule(&id, &principal).await?; Defensive patterns
Strategy: validation
Validate before calling
fn principal_is_known(dir: &PrincipalDirectory, p: &PrincipalId) -> bool { dir.uid_for(p).is_ok() } Try / catch
match kernel.remove_one_capsule(&id, &principal).await {
Err(e) if e.to_string().starts_with("resolve durable owner") => {
error!("principal {principal} not in directory; re-register before delete");
},
other => other?,
} Prevention
- Verify the principal is registered in the directory before admin operations.
- Monitor directory backend health and alert on resolution failures.
- Re-sync directory mappings after identity migrations.
When it happens
Trigger: `principal_directory.uid_for()` returns an error for the given `PrincipalId` — the principal is unknown to the directory, the directory backend is unavailable, or the identity mapping is stale after a re-provisioning.
Common situations: Deleting a capsule for a principal whose account was just deleted or rotated; a directory service outage mid-admin-operation; identity migration leaving old PrincipalIds unresolvable.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- authoritative principal store is unavailable
- read durable capsule package '{id}': {error}
- remove durable capsule package '{id}': {error}
- unexpected response from kernel: {other:?}
- unexpected {kind:?} in a canonical File owning closure
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/c4fbe2414787710c.
Report an issue: GitHub.