astrid-runtime/astrid · error

Capsule '{name}' is not installed.

Error message

Capsule '{name}' is not installed.

What it means

During workspace capsule removal, validate_capsule_removal_from_home_for_in_workspace resolves the capsule's directory inside the workspace and bails if that directory does not exist. The name given to 'capsule remove' matches nothing installed in the workspace home, so there is nothing to remove. This is a pre-flight existence check before meta/dependency validation.

Source

Thrown at crates/astrid-cli/src/commands/capsule/remove.rs:185

fn validate_capsule_removal_from_home_for_in_workspace(
    home: &AstridHome,
    principal: &PrincipalId,
    name: &str,
    workspace: bool,
    workspace_root: Option<&Path>,
    force: bool,
) -> anyhow::Result<()> {
    let target_dir = astrid_capsule_install::paths::resolve_target_dir_for_in_workspace(
        home,
        principal,
        name,
        workspace,
        workspace_root,
        crate::workspace_layout::current(),
    )?;

    if !target_dir.exists() {
        bail!("Capsule '{name}' is not installed.");
    }

    let target_meta = super::meta::read_meta(&target_dir);

    // Scan once, reuse for both dependency check and binary cleanup
    let all_capsules =
        astrid_capsule_install::meta::scan_installed_capsules_in_home_for_in_workspace(
            home,
            principal,
            workspace_root,
            crate::workspace_layout::current(),
        )?;

    // Dependency safety check (skip with --force)
    if !force && let Some(block) = check_removal_safety(name, target_meta.as_ref(), &all_capsules) {
        bail!(
            "Cannot remove '{name}': it is the sole provider of '{}' \
             which is required by '{}'. Use --force to override.",

View on GitHub (pinned to affd8760f4)

Solutions

  1. Run the workspace capsule list command to see the exact installed names and correct the spelling.
  2. Confirm you are operating in the intended workspace (the removal resolves against the current workspace root).
  3. If the capsule was already removed, nothing more is needed — treat this as a no-op rather than forcing.

Example fix

// before
astrid capsule remove my-capsule --workspace   // NameNotFound
// after
astrid capsule list                            // find exact name
astrid capsule remove my_capsule --workspace
Defensive patterns

Strategy: validation

Validate before calling

let target = resolve_capsule_dir(&workspace_root, name)?;
if !target.exists() {
    eprintln!("capsule '{name}' is not installed in this workspace");
    return Ok(()); // treat as no-op
}

Type guard

fn is_installed(workspace_root: &Path, name: &str) -> bool {
    workspace_root.join("capsules").join(name).is_dir()
}

Try / catch

match remove_capsule(...).await {
    Err(e) if e.to_string().contains("is not installed") => {
        // already removed — log and continue in bulk scripts
    }
    r => r?,
}

Prevention

When it happens

Trigger: astrid capsule remove <name> --workspace where the computed target_dir for <name> is absent — the capsule was never installed in this workspace, was already removed, or is spelled differently.

Common situations: Typo in the capsule name; removing from the wrong workspace directory; capsule already uninstalled by a previous run; case-sensitive name mismatch.

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/6fbe239c541ee47c. Report an issue: GitHub.