rtk-ai/rtk · error

Shared Pi/OMP extension at

Error message

Shared Pi/OMP extension at {} was not removed; rerun with --auto-patch to approve the removal.

What it means

When removing the shared Pi/OMP extension file (a single file used by both Pi and OpenAI-compatible/OMP agents), rtk requires explicit approval because removing it affects more than one agent. If the removal policy did not approve the action (auto-patch not enabled), rtk bails telling the user to rerun with `--auto-patch`. In dry-run mode the removal is only previewed.

Solutions

  1. Rerun with `rtk init --auto-patch` to approve removal of the shared extension file.
  2. Preview first with `rtk init --auto-patch --dry-run`, then run without `--dry-run`.
  3. Delete the shared file manually if you prefer not to grant auto-patch.
  4. If the file is actually needed by the other agent, leave it and skip the removal step.

Example fix

// before (shell)
rtk init   # shared file not removed
// after (shell)
rtk init --auto-patch
Defensive patterns

Strategy: try-catch

Try / catch

rtk init --auto-patch || echo 'Shared Pi/OMP extension removal failed — remove the file manually'

Prevention

When it happens

Trigger: Running `rtk init` uninstall flow where `validate_stock_pi_plugin_path` reports the shared plugin path is present and removable, but `patch_mode` is not auto-patch (and not dry-run), so the action was skipped/declined.

Common situations: Interactive run where the user declined the removal prompt; script forgot the `--auto-patch` flag; dry-run executed first and the user reran without flags.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


AI-assisted analysis of rtk-ai/rtk@0924356b4c (2026-09-19). Data as JSON: /api/errors/183e6d68e39551f8. Report an issue: GitHub.

Appendix: source

Thrown at src/hooks/init.rs:4393

        );
        if dry_run {
            print_dry_run_footer();
        }
        return Ok(());
    }

    if !confirm_shared_extension_uninstall(
        global,
        &plugin_path,
        PiCompatibleAgent::Pi,
        patch_mode,
        ctx,
    )? {
        if dry_run {
            print_dry_run_footer();
            return Ok(());
        }
        anyhow::bail!(
            "Shared Pi/OMP extension at {} was not removed; rerun with --auto-patch to approve the removal.",
            plugin_path.display()
        );
    }

    if dry_run {
        println!(
            "[dry-run] would remove Pi extension: {}",
            plugin_path.display()
        );
        remove_managed_agent_state(&ownership_state_path, ctx)?;
        print_dry_run_footer();
    } else {
        // nosemgrep: filesystem-deletion -- Pi uninstall removes only a known RTK stock extension.
        fs::remove_file(&plugin_path)
            .with_context(|| format!("Failed to remove Pi extension: {}", plugin_path.display()))?;
        remove_managed_agent_state(&ownership_state_path, ctx)?;
        if verbose > 0 {

View on GitHub (pinned to 0924356b4c)