{"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":"exception","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, .claude-plugin/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/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/plugins/install/stage.rs#L90-L126","documentation":"`stage_local_copy` refuses to stage a local bundle whose canonical path is inside the user plugins directory — those files are already installed in place, and copying them onto themselves via staging is meaningless/dangerous. The error reports the canonical plugins dir.","triggerScenarios":"Calling `/plugin install <path>` (through `install_inner` → `stage_local_copy`) where `<path>` is inside (or equals) the user plugins directory, e.g. installing a plugin from the very directory it would be installed into.","commonSituations":"Running install with the plugins dir itself as the source path; installing a subdirectory of the plugins dir; pointing the install source at `~/.codewhale/plugins/...` by mistake.","solutions":["Install from the original source location outside the plugins directory","If the bundle is already installed in place, no install is needed — enable it instead (`/plugin enable <name>`)","Move the bundle out of the plugins dir first if you truly need to (re)install it"],"exampleFix":"// before\n/plugin install ~/.codewhale/plugins/myplugin\n// after: install from the project source\n/plugin install ~/projects/myplugin","handlingStrategy":"validation","validationCode":"let canon_source = fs::canonicalize(source_path)?;\nlet canon_plugins = fs::canonicalize(user_plugins_dir)?;\nif canon_source.starts_with(&canon_plugins) {\n    eprintln!(\"source is already inside the plugins dir; nothing to install\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"match install(path) {\n    Err(e) if e.to_string().contains(\"already in place\") => {\n        eprintln!(\"bundle already lives in the plugins dir; enable it instead\");\n    }\n    other => other?,\n}","preventionTips":["Install from project/source directories, never from the plugins dir","Check the canonicalized path when source locations are configured dynamically","If already installed, use enable/update instead of reinstall"],"tags":["plugins","install","invalid-argument"],"backgroundTag":"invalid-argument-value","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}