rtk-ai/rtk · error · anyhow::Error
Cursor uninstall only works with --global flag
Error message
Cursor uninstall only works with --global flag
What it means
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.
Source
Thrown at src/hooks/init.rs:661
global: bool,
gemini: bool,
codex: bool,
cursor: bool,
pi: bool,
ctx: InitContext,
) -> Result<()> {
let InitContext { verbose, dry_run } = ctx;
if codex {
uninstall_codex(global, ctx)?;
if dry_run {
print_dry_run_footer();
}
return Ok(());
}
if cursor {
if !global {
anyhow::bail!("Cursor uninstall only works with --global flag");
}
let cursor_removed = remove_cursor_hooks(ctx).context("Failed to remove Cursor hooks")?;
if !cursor_removed.is_empty() {
let header = if dry_run {
"[dry-run] would uninstall RTK (Cursor):"
} else {
"RTK uninstalled (Cursor):"
};
println!("{}", header);
for item in &cursor_removed {
println!(" - {}", item);
}
if !dry_run {
println!("\nRestart Cursor to apply changes.");
}
} else {
println!("RTK Cursor support was not installed (nothing to remove)");
}View on GitHub (pinned to d977e1c316)
Solutions
- Run `rtk uninstall --global --cursor`
- Preview what will be removed first: `rtk uninstall --global --cursor --dry-run`
Example fix
# before rtk uninstall --cursor # after rtk uninstall --global --cursor --dry-run # preview rtk uninstall --global --cursor
Defensive patterns
Strategy: validation
Validate before calling
# bash: enforce the flag rule before uninstalling
if [[ "$TARGET" == cursor && "$GLOBAL" != 1 ]]; then
echo 'cursor uninstall requires --global' >&2; exit 2
fi
rtk uninstall ${GLOBAL:+--global} --cursor Prevention
- Always pair --cursor with --global in aliases and docs
- Run uninstall with --dry-run in scripts before the destructive pass
When it happens
Trigger: `rtk uninstall --cursor` without `--global` — the bail at src/hooks/init.rs:663.
Common situations: 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).
Related errors
- Windsurf support is global-only. Use: rtk init -g --agent wi
- Uninstall only works with --global flag. For local projects,
- Uninstall only works with --global flag. For local projects,
- Gemini support is global-only. Use: rtk init -g --gemini
- Vibe support is global-only. Use: rtk init -g --agent vibe
AI-assisted analysis of rtk-ai/rtk@d977e1c316 (2026-08-16).
Data as JSON: /api/errors/b4eab9f51bc32ec5.
Report an issue: GitHub.