astrid-runtime/astrid · error

capsule {id} disappeared during introspection

Error message

capsule {id} disappeared during introspection

What it means

list_durable_capsule_packages lists capsule summaries for an owner, then fetches each one's full snapshot via registry.get_snapshot. A None snapshot for an ID present in the listing means the capsule disappeared between the two calls; the function raises instead of returning a partial list.

Source

Thrown at crates/astrid-capsule-install/src/principal_introspection.rs:46

///
/// # Errors
///
/// Returns an error when the owner content graph is unavailable, a reserved
/// package path is malformed, or a package disappears during readback.
pub fn list_durable_capsule_packages(
    store: &Arc<RuntimePrincipalStore>,
    uid: PrincipalUid,
) -> anyhow::Result<Vec<DurableCapsuleIntrospection>> {
    let owner = StateOwner::Principal(uid);
    let registry = store.capsules();
    registry
        .list(&owner)?
        .into_iter()
        .map(|summary| {
            let id = summary.id().to_owned();
            let snapshot = registry
                .get_snapshot(&owner, &id)?
                .ok_or_else(|| anyhow::anyhow!("capsule {id} disappeared during introspection"))?;
            Ok(DurableCapsuleIntrospection { id, snapshot })
        })
        .collect()
}

/// Read one installed package by immutable UID and canonical identifier.
///
/// # Errors
///
/// Returns an error when the identifier is invalid, the package is absent or
/// malformed, or the owner content graph cannot be verified.
pub fn read_durable_capsule_package(
    store: &Arc<RuntimePrincipalStore>,
    uid: PrincipalUid,
    id: &str,
) -> anyhow::Result<DurableCapsuleIntrospection> {
    let owner = StateOwner::Principal(uid);
    let snapshot = store

View on GitHub (pinned to affd8760f4)

Solutions

  1. Re-run the introspection after concurrent operations finish.
  2. Serialize registry mutations and introspection with a lock or per-user store isolation.
  3. Check for orphaned entries (listed but unreadable) and clean/repair the registry store.
  4. If persistent, republish or reinstall the affected capsule to restore its snapshot.
Defensive patterns

Strategy: retry

Try / catch

match list_durable_capsule_packages(&registry, &owner) {
    Err(e) if e.to_string().contains("disappeared during introspection") => {
        // concurrent mutation: retry once after a short delay
        std::thread::sleep(std::time::Duration::from_millis(250));
        list_durable_capsule_packages(&registry, &owner)?
    }
    other => other?,
}

Prevention

When it happens

Trigger: Iterating installed capsules for introspection while a concurrent install/remove/publish mutates the registry, so get_snapshot returns None for a listed ID.

Common situations: Running `capsule list`/introspection tooling at the same time as an install or uninstall in another shell; CI jobs sharing a capsule store without isolation; crashed removal leaving listing entries without snapshots.

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


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/90f7c639e4871628. Report an issue: GitHub.