nikivdev/code · warning

Commit aborted after auto-fix. Review changes and retry.

Error message

Commit aborted after auto-fix. Review changes and retry.

What it means

This error is raised by `warn_secrets_in_diff` after an automatic AI-assisted fix (`run_fix_f_commit_ai`) re-scanned the diff: the scan is clean, the user was asked to confirm continuation and declined, so the commit is aborted. It differs from 255 only in that the fix was applied automatically by the `ai` CLI rather than manually by the user.

Source

Thrown at src/commit.rs:425

    } else if !agent_enabled {
        eprintln!("ℹ️  manual fix-f-commit handoff disabled via FLOW_FIX_COMMIT_AGENT=off");
    }

    if interactive && !current_findings.is_empty() && ai_available {
        if prompt_yes_no_default_yes("Run auto-fix with ai?")? {
            let task = build_fix_f_commit_task(&current_findings);
            println!("Running auto-fix with ai...");
            if let Err(err) = run_fix_f_commit_ai(repo_root, &task) {
                eprintln!("⚠ Failed to run ai auto-fix: {err}");
            }
            rescan_after_fix(&mut current_findings)?;
            if current_findings.is_empty() {
                if prompt_yes_no_default_yes(
                    "Secret scan is clean after auto-fix. Continue with commit?",
                )? {
                    return Ok(());
                }
                bail!("Commit aborted after auto-fix. Review changes and retry.");
            }
        }
    }

    if current_findings != findings {
        print_secret_findings(
            "🔐 Potential secrets still detected in staged changes:",
            &current_findings,
        );
        println!();
    }

    let task = build_fix_f_commit_task(&current_findings);
    if !task.trim().is_empty() {
        eprintln!("Suggested prompt (copy/paste into your model):");
        eprintln!("────────────────────────────────────────");
        eprintln!("{}", task);
        eprintln!("────────────────────────────────────────");

View on GitHub (pinned to a747e741ae)

Solutions

  1. Review the auto-applied changes with `git diff --cached`, then re-run the commit flow and confirm with 'yes'.
  2. If the auto-fix was wrong, revert the affected hunks and redact manually, then retry.
  3. Disable the AI auto-fix path with `FLOW_FIX_COMMIT_AGENT=off` to handle findings manually next time.
Defensive patterns

Strategy: try-catch

Validate before calling

// after an AI auto-fix, verify the diff no longer contains findings before continuing
let findings = scan_diff_for_secrets(repo_root);
if !findings.is_empty() { eprintln!("auto-fix incomplete; {:?} remain", findings); }

Try / catch

match run_fast() {
    Err(e) if e.to_string().contains("Commit aborted after auto-fix") => {
        // user declined the auto-fixed diff; inspect and re-run
        eprintln!("review AI-modified files with git diff --cached, then re-run");
    }
    Err(e) => return Err(e),
    Ok(_) => {}
}

Prevention

When it happens

Trigger: During the commit flow, secrets were found, FLOW_FIX_COMMIT_AGENT enabled the AI auto-fix path, `run_fix_f_commit_ai` succeeded, the re-scan found nothing, and the user answered 'no' to 'Secret scan is clean after auto-fix. Continue with commit?'.

Common situations: User distrusts the auto-redaction and wants to review changes manually first, or wants to inspect what the AI modified before allowing the commit.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/6ede7673cdca8c61. Report an issue: GitHub.