{"record":{"id":"1964c14bdd5a8ddf","repo":"rtk-ai/rtk","slug":"uninstall-only-works-with-global-flag-for-local","errorCode":null,"errorMessage":"Uninstall only works with --global flag. For local projects, manually remove RTK from CLAUDE.md","messagePattern":"Uninstall only works with --global flag\\. For local projects, manually remove RTK from CLAUDE\\.md","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/hooks/init.rs","lineNumber":956,"sourceCode":"        }\n        if dry_run {\n            print_dry_run_footer();\n        }\n        return Ok(());\n    }\n\n    if pi {\n        uninstall_pi_with_patch_mode(global, patch_mode, ctx)?;\n        return Ok(());\n    }\n\n    if omp {\n        uninstall_omp_with_patch_mode(global, patch_mode, ctx)?;\n        return Ok(());\n    }\n\n    if !global {\n        anyhow::bail!(\n            \"Uninstall only works with --global flag. For local projects, manually remove RTK from CLAUDE.md\"\n        );\n    }\n\n    let claude_dir = resolve_claude_dir()?;\n    let mut removed = Vec::new();\n\n    // Also uninstall Gemini artifacts if --gemini or always (clean everything)\n    if gemini {\n        let gemini_removed = uninstall_gemini(ctx)?;\n        removed.extend(gemini_removed);\n        if !removed.is_empty() {\n            let header = if dry_run {\n                \"[dry-run] would uninstall RTK (Gemini):\"\n            } else {\n                \"RTK uninstalled (Gemini):\"\n            };\n            println!(\"{}\", header);","sourceCodeStart":938,"sourceCodeEnd":974,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/hooks/init.rs#L938-L974","documentation":"Thrown by uninstall_with_patch_mode when `uninstall` is invoked without `--global`. RTK's uninstaller only removes global (user-level) installations; it refuses to touch project-local files. For local setups the user is instructed to manually delete the RTK block from the project's CLAUDE.md.","triggerScenarios":"Calling `rtk uninstall` (or `rtk uninstall --claude-md`-style variants) with global=false. The bail fires in uninstall_with_patch_mode at src/hooks/init.rs:955-958 right after the omp/cursor early-returns and before resolve_claude_dir().","commonSituations":"Trying to remove RTK from a single repo after having installed it locally via `rtk init --claude-md`; automated cleanup scripts that assume uninstall works everywhere; users who installed locally and later forgot that uninstall is global-only.","solutions":["Re-run with the global flag: `rtk uninstall -g`.","For local installs, manually open the project's CLAUDE.md and delete the RTK block (text between the RTK block markers).","Search the repo for the RTK block markers (e.g. grep for 'rtk' in CLAUDE.md) to locate what to remove."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# add -g for plain uninstall; local cleanup is manual\nif rtk uninstall 2>err.txt; then :; else\n  grep -q 'only works with --global' err.txt && rtk uninstall -g\nfi","typeGuard":null,"tryCatchPattern":"if ! rtk uninstall 2>err.txt; then\n  grep -q 'only works with --global' err.txt && rtk uninstall -g || echo \"remove RTK block from CLAUDE.md manually\"\nfi","preventionTips":["Default to `rtk uninstall -g` in cleanup scripts.","For local installs, document that removal is manual (delete the RTK block in CLAUDE.md).","Prefer global installs to keep uninstall automated."],"tags":["cli","uninstall","global-only","claude-md"],"backgroundTag":"missing-required-flag","analyzedSha":"0924356b4caba4989607227b7c8824d3d8098719","analyzedAt":"2026-09-19T19:25:29.612Z","contentChangedAt":"2026-09-19T19:25:29.612Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}