{"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":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/hooks/init.rs","lineNumber":661,"sourceCode":"    global: bool,\n    gemini: bool,\n    codex: bool,\n    cursor: bool,\n    pi: bool,\n    ctx: InitContext,\n) -> Result<()> {\n    let InitContext { verbose, dry_run } = 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":643,"sourceCodeEnd":679,"githubUrl":"https://github.com/rtk-ai/rtk/blob/d977e1c31621fe8704e6500ceeb9c7a0de2b6836/src/hooks/init.rs#L643-L679","documentation":"RTK's Cursor hooks are only ever installed globally (Cursor user settings), so the uninstaller refuses a scoped `--cursor` uninstall instead of pretending it cleaned something. The check runs before remove_cursor_hooks is called, so no files are touched.","triggerScenarios":"`rtk uninstall --cursor` without `--global` — the bail at src/hooks/init.rs:663.","commonSituations":"Copy-pasting the install command and changing 'init' to 'uninstall' but dropping -g; muscle-memory from `rtk uninstall` for local Claude projects (which is also rejected).","solutions":["Run `rtk uninstall --global --cursor`","Preview what will be removed first: `rtk uninstall --global --cursor --dry-run`"],"exampleFix":"# before\nrtk uninstall --cursor\n\n# after\nrtk uninstall --global --cursor --dry-run   # preview\nrtk uninstall --global --cursor","handlingStrategy":"validation","validationCode":"# bash: enforce the flag rule before uninstalling\nif [[ \"$TARGET\" == cursor && \"$GLOBAL\" != 1 ]]; then\n  echo 'cursor uninstall requires --global' >&2; exit 2\nfi\nrtk uninstall ${GLOBAL:+--global} --cursor","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair --cursor with --global in aliases and docs","Run uninstall with --dry-run in scripts before the destructive pass"],"tags":["cli","uninstall","cursor","agent-scoping"],"backgroundTag":null,"analyzedSha":"d977e1c31621fe8704e6500ceeb9c7a0de2b6836","analyzedAt":"2026-08-16T05:40:46.291Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}