rtk-ai/rtk · error · anyhow::Error

Uninstall only works with --global flag. For local projects,

Error message

Uninstall only works with --global flag. For local projects, manually remove RTK from CLAUDE.md

What it means

Global uninstall removes RTK hooks from ~/.claude and the global CLAUDE.md; RTK intentionally ships no uninstaller for per-project CLAUDE.md edits because that file is user-owned. Run without --global (and after the codex/cursor/pi special cases return early), it bails and points at the manual path.

Source

Thrown at src/hooks/init.rs:692

            if !dry_run {
                println!("\nRestart Cursor to apply changes.");
            }
        } else {
            println!("RTK Cursor support was not installed (nothing to remove)");
        }
        if dry_run {
            print_dry_run_footer();
        }
        return Ok(());
    }

    if pi {
        uninstall_pi(global, ctx)?;
        return Ok(());
    }

    if !global {
        anyhow::bail!("Uninstall only works with --global flag. For local projects, manually remove RTK from CLAUDE.md");
    }

    let claude_dir = resolve_claude_dir()?;
    let mut removed = Vec::new();

    // Also uninstall Gemini artifacts if --gemini or always (clean everything)
    if gemini {
        let gemini_removed = uninstall_gemini(ctx)?;
        removed.extend(gemini_removed);
        if !removed.is_empty() {
            let header = if dry_run {
                "[dry-run] would uninstall RTK (Gemini):"
            } else {
                "RTK uninstalled (Gemini):"
            };
            println!("{}", header);
            for item in &removed {
                println!("  - {}", item);

View on GitHub (pinned to d977e1c316)

Solutions

  1. Remove the RTK block (between the rtk-instructions markers) and the '@RTK.md' reference from ./CLAUDE.md by hand, plus any local .claude/settings.json hooks rtk added
  2. Run `rtk uninstall --global` if the goal was cleaning the machine-wide install
  3. Commit the CLAUDE.md removal so teammates' copies are cleaned too

Example fix

# error path
rtk uninstall                 # bails: global-only

# what a project cleanup actually needs
edit ./CLAUDE.md               # delete the rtk-instructions block and '@RTK.md' line
rtk uninstall --global        # only if you also meant the global install
Defensive patterns

Strategy: validation

Validate before calling

# bash: decide intent before running uninstall
# project cleanup → manual edit; machine cleanup → --global
[ "$SCOPE" = project ] && { echo 'edit ./CLAUDE.md manually'; exit 0; }
rtk uninstall --global

Prevention

When it happens

Trigger: `rtk uninstall` with no `--global` flag — src/hooks/init.rs:694.

Common situations: Trying to undo a local `rtk init` in a repo after abandoning RTK; expecting uninstall to be symmetric with every install mode.

Related errors


AI-assisted analysis of rtk-ai/rtk@d977e1c316 (2026-08-16). Data as JSON: /api/errors/1964c14bdd5a8ddf. Report an issue: GitHub.