rtk-ai/rtk · error

Pi extension at was not changed; remove or back up the file…

Error message

Pi extension at {} was not changed; remove or back up the file manually before retrying.

What it means

Before installing/patching the Pi extension, `validate_stock_pi_plugin_path` checks the existing file at the target path against the removal/patch policy. If validation returns false (policy declined, skipped, or only previewed) and the run is not a dry-run, rtk aborts so it never overwrites a stock or unrecognized extension file it did not validate. The user must remove or back up the file manually before retrying.

Solutions

  1. Rerun with `rtk init --auto-patch` so rtk may remove/replace the existing stock file.
  2. Back up and delete the file manually (`mv <path> <path>.bak`), then rerun `rtk init`.
  3. Preview the intended action first with `rtk init --auto-patch --dry-run`.
  4. If the existing file is not RTK's, choose a different extension path or leave it in place.

Example fix

// before (shell)
rtk init   # Pi extension not changed
// after (shell)
mv ~/.pi/extensions/rtk.ts ~/.pi/extensions/rtk.ts.bak && rtk init --auto-patch
Defensive patterns

Strategy: fallback

Validate before calling

f=~/.pi/extensions/rtk.ts
if [ -f "$f" ]; then echo "$f exists — use --auto-patch or remove it before rtk init"; fi

Try / catch

rtk init || { mv <path> <path>.bak && rtk init --auto-patch; }

Prevention

When it happens

Trigger: Running `rtk init` Pi install/patch mode where the target plugin file exists, `validate_stock_pi_plugin_path` returns false (e.g. file is stock/unrecognized content and patch_mode declined removal), and dry_run is false.

Common situations: Non-interactive run without `--auto-patch` when a stock extension already exists; user declined the interactive prompt; leftover stock file from a different tool occupying the path.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at src/hooks/init.rs:4448

/// Install the Pi extension with an explicit confirmation policy for an
/// existing non-stock file.
pub fn run_pi_mode_with_patch_mode(
    global: bool,
    patch_mode: PatchMode,
    ctx: InitContext,
) -> Result<()> {
    let InitContext { dry_run, .. } = ctx;
    let plugin_path = pi_plugin_path_for_scope(global)?;
    let extension_was_present = plugin_path.exists();

    warn_if_extension_shared_on_install(global, &plugin_path, PiCompatibleAgent::Pi)?;

    if !validate_stock_pi_plugin_path(&plugin_path, "Pi extension", patch_mode, ctx)? {
        if dry_run {
            print_dry_run_footer();
            return Ok(());
        }
        anyhow::bail!(
            "Pi extension at {} was not changed; remove or back up the file manually before retrying.",
            plugin_path.display()
        );
    }

    if let Some(parent) = plugin_path.parent() {
        ensure_pi_extensions_dir(
            parent,
            if global {
                "Pi extensions directory"
            } else {
                "local Pi extensions directory"
            },
            ctx,
        )?;
    }

    let installed =

View on GitHub (pinned to 0924356b4c)