{"record":{"id":"6fbe239c541ee47c","repo":"astrid-runtime/astrid","slug":"capsule-name-is-not-installed-6fbe23","errorCode":null,"errorMessage":"Capsule '{name}' is not installed.","messagePattern":"Capsule '(.+?)' is not installed\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/capsule/remove.rs","lineNumber":185,"sourceCode":"fn validate_capsule_removal_from_home_for_in_workspace(\n    home: &AstridHome,\n    principal: &PrincipalId,\n    name: &str,\n    workspace: bool,\n    workspace_root: Option<&Path>,\n    force: bool,\n) -> anyhow::Result<()> {\n    let target_dir = astrid_capsule_install::paths::resolve_target_dir_for_in_workspace(\n        home,\n        principal,\n        name,\n        workspace,\n        workspace_root,\n        crate::workspace_layout::current(),\n    )?;\n\n    if !target_dir.exists() {\n        bail!(\"Capsule '{name}' is not installed.\");\n    }\n\n    let target_meta = super::meta::read_meta(&target_dir);\n\n    // Scan once, reuse for both dependency check and binary cleanup\n    let all_capsules =\n        astrid_capsule_install::meta::scan_installed_capsules_in_home_for_in_workspace(\n            home,\n            principal,\n            workspace_root,\n            crate::workspace_layout::current(),\n        )?;\n\n    // Dependency safety check (skip with --force)\n    if !force && let Some(block) = check_removal_safety(name, target_meta.as_ref(), &all_capsules) {\n        bail!(\n            \"Cannot remove '{name}': it is the sole provider of '{}' \\\n             which is required by '{}'. Use --force to override.\",","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/capsule/remove.rs#L167-L203","documentation":"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.","triggerScenarios":"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.","commonSituations":"Typo in the capsule name; removing from the wrong workspace directory; capsule already uninstalled by a previous run; case-sensitive name mismatch.","solutions":["Run the workspace capsule list command to see the exact installed names and correct the spelling.","Confirm you are operating in the intended workspace (the removal resolves against the current workspace root).","If the capsule was already removed, nothing more is needed — treat this as a no-op rather than forcing."],"exampleFix":"// before\nastrid capsule remove my-capsule --workspace   // NameNotFound\n// after\nastrid capsule list                            // find exact name\nastrid capsule remove my_capsule --workspace","handlingStrategy":"validation","validationCode":"let target = resolve_capsule_dir(&workspace_root, name)?;\nif !target.exists() {\n    eprintln!(\"capsule '{name}' is not installed in this workspace\");\n    return Ok(()); // treat as no-op\n}","typeGuard":"fn is_installed(workspace_root: &Path, name: &str) -> bool {\n    workspace_root.join(\"capsules\").join(name).is_dir()\n}","tryCatchPattern":"match remove_capsule(...).await {\n    Err(e) if e.to_string().contains(\"is not installed\") => {\n        // already removed — log and continue in bulk scripts\n    }\n    r => r?,\n}","preventionTips":["List installed capsules to copy exact names (watch underscores vs hyphens).","Confirm the current workspace root before removal.","Make bulk-removal scripts idempotent by tolerating this error."],"tags":["cli","capsule","not-found"],"backgroundTag":"resource-not-found","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"}