{"record":{"id":"b4eab9f51bc32ec5","repo":"rtk-ai/rtk","slug":"cursor-uninstall-only-works-with-global-flag","errorCode":null,"errorMessage":"Cursor uninstall only works with --global flag","messagePattern":"Cursor uninstall only works with --global flag","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/hooks/init.rs","lineNumber":920,"sourceCode":"    pi: bool,\n    omp: bool,\n    patch_mode: PatchMode,\n    ctx: InitContext,\n) -> Result<()> {\n    let InitContext {\n        verbose, dry_run, ..\n    } = ctx;\n    if codex {\n        uninstall_codex(global, ctx)?;\n        if dry_run {\n            print_dry_run_footer();\n        }\n        return Ok(());\n    }\n\n    if cursor {\n        if !global {\n            anyhow::bail!(\"Cursor uninstall only works with --global flag\");\n        }\n        let cursor_removed = remove_cursor_hooks(ctx).context(\"Failed to remove Cursor hooks\")?;\n        if !cursor_removed.is_empty() {\n            let header = if dry_run {\n                \"[dry-run] would uninstall RTK (Cursor):\"\n            } else {\n                \"RTK uninstalled (Cursor):\"\n            };\n            println!(\"{}\", header);\n            for item in &cursor_removed {\n                println!(\"  - {}\", item);\n            }\n            if !dry_run {\n                println!(\"\\nRestart Cursor to apply changes.\");\n            }\n        } else {\n            println!(\"RTK Cursor support was not installed (nothing to remove)\");\n        }","sourceCodeStart":902,"sourceCodeEnd":938,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/hooks/init.rs#L902-L938","documentation":"Thrown by uninstall_with_patch_mode when Cursor hooks uninstall (`--cursor`) is requested without `--global`. Cursor hook removal operates exclusively on the global Cursor configuration, so a non-global uninstall path does not exist. This mirrors the install-side global-only rule for Cursor.","triggerScenarios":"Calling `rtk uninstall --cursor` (cursor=true, global=false). The bail fires in uninstall_with_patch_mode at src/hooks/init.rs:919-921 before remove_cursor_hooks is invoked.","commonSituations":"Cleaning up RTK after switching tools and running uninstall inside a repo without `-g`; scripting uninstall for all agents uniformly and forgetting Cursor requires global; running the same uninstall command that previously succeeded for claude-based hooks.","solutions":["Re-run with the global flag: `rtk uninstall -g --cursor`.","If unsure whether Cursor hooks exist, run the global uninstall in dry-run mode to list what would be removed.","If only local project artifacts should be cleaned, drop `--cursor` and manually remove RTK entries from the project's CLAUDE.md instead."],"exampleFix":"// before (shell)\nrtk uninstall --cursor\n// after (shell)\nrtk uninstall -g --cursor","handlingStrategy":"try-catch","validationCode":"# ensure the global flag is present for cursor uninstall\ncase \" $* \" in\n  *\" --cursor \"*) [[ \" $* \" == *\" -g \"* || \" $* \" == *\" --global \"* ]] || set -- -g \"$@\";;\nesac\nrtk uninstall \"$@\"","typeGuard":null,"tryCatchPattern":"if ! rtk uninstall --cursor 2>err.txt; then\n  grep -q 'only works with --global' err.txt && rtk uninstall -g --cursor\nfi","preventionTips":["Always pass `-g` when uninstalling cursor hooks.","Use dry-run first to preview global removals.","Keep uninstall scripts symmetric with install scripts regarding the global flag."],"tags":["cli","uninstall","cursor","global-only"],"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"}