{"record":{"id":"ecbbfe8ce9bb6213","repo":"Hmbown/CodeWhale","slug":"cannot-install-a-bundle-from-inside-the-user-plugi","errorCode":null,"errorMessage":"cannot install a bundle from inside the user plugins directory {}; it is already in place","messagePattern":"cannot install a bundle from inside the user plugins directory (.+?); it is already in place","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/plugins/install/stage.rs","lineNumber":108,"sourceCode":"    max_size: u64,\n) -> Result<StagedPlugin> {\n    // Validate the source first; this also rejects symlinked roots/manifests.\n    let manifest_path =\n        crate::plugins::agent_plugin::resolve_manifest_path(source).ok_or_else(|| {\n            anyhow::anyhow!(\n                \"source is not a valid plugin bundle: no plugin.json, kimi.plugin.json, or plugin.toml\"\n            )\n        })?;\n    PluginManifest::validate_from_path(&manifest_path)\n        .map_err(|error| anyhow::anyhow!(\"source is not a valid plugin bundle: {error}\"))?;\n    let canonical_source = source\n        .canonicalize()\n        .with_context(|| format!(\"failed to resolve {}\", source.display()))?;\n    if let Ok(canonical_plugins) = user_plugins_dir.canonicalize()\n        && (canonical_source == canonical_plugins\n            || canonical_source.starts_with(&canonical_plugins))\n    {\n        bail!(\n            \"cannot install a bundle from inside the user plugins directory {}; \\\n             it is already in place\",\n            canonical_plugins.display()\n        );\n    }\n\n    let staged_path = fresh_staging_dir(user_plugins_dir)?;\n    let result = (|| -> Result<StagedPlugin> {\n        let mut budget = CopyBudget::default();\n        copy_bundle_regular_files(&canonical_source, &staged_path, max_size, &mut budget)?;\n        let (name, content_hash) = validate_staged(&staged_path)?;\n        Ok(StagedPlugin {\n            name,\n            staged_path: staged_path.clone(),\n            content_hash,\n        })\n    })();\n    if result.is_err() {","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/plugins/install/stage.rs#L90-L126","documentation":"stage_local_copy canonicalized the source and found it lies inside the user plugins directory itself. Copying a bundle onto itself would nest or duplicate it, so the guard fires and tells the user the bundle is already in place.","triggerScenarios":"Thrown at crates/tui/src/plugins/install/stage.rs:108 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Skip installation — the bundle is already installed","Or move the source outside the plugins directory first"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}