Multi-Cursor Edit Conflict Fix (2026)

The Error

Error: Edit tool failed — old_string not found in file
  File 'src/components/Header.tsx' was modified by editor (multi-cursor edit active)
  File on disk differs from Claude Code's cached version
  3 unsaved editor changes conflict with Claude Code's planned edit

This appears when you are actively editing a file in your IDE with multi-cursor selections while Claude Code tries to edit the same file via its Edit tool.

The Fix

# In your editor: Save all files (Cmd+S / Ctrl+S)
# Then ask Claude to retry:
claude "Retry the edit on src/components/Header.tsx"
  1. Save all open files in your editor to flush changes to disk.
  2. Wait for the editor’s auto-save to complete (if enabled).
  3. Ask Claude Code to retry the edit — it will re-read the file and apply the change.

Why This Happens

Claude Code’s Edit tool works by reading the file from disk, finding an exact string match (old_string), and writing the replacement. If your IDE has unsaved changes (especially from multi-cursor edits that modify many lines simultaneously), the file on disk differs from what Claude Code expects. The exact string match fails because the old_string was based on the pre-edit file state. This race condition is most common with VS Code’s auto-save delay.

If That Doesn’t Work

Disable auto-save temporarily and save manually:

// .vscode/settings.json
{
  "files.autoSave": "off"
}

Close the file in your editor before asking Claude to edit:

claude "Close any editor tabs for Header.tsx, then edit it"

Use Claude Code’s Write tool for a full file replacement instead:

claude "Rewrite the entire Header.tsx file with the updated version"

Prevention

# CLAUDE.md rule
Before making edits, save all open editor files. Do not edit files in the IDE while Claude Code is working on them. Use VS Code auto-save with a short delay (1 second) to minimize conflicts.

See Also

Frequently Asked Questions

Does this error affect all operating systems?

This error can occur on macOS, Linux, and Windows (WSL). The exact error message may differ slightly between platforms, but the root cause and fix are the same. macOS users may see additional Gatekeeper or notarization prompts. Linux users should check that the relevant system packages are installed. Windows users should ensure they are running inside WSL2, not native Windows.

Will this error come back after updating Claude Code?

Updates can occasionally reintroduce this error if the update changes default configurations or dependency requirements. After updating Claude Code, verify your project still builds and runs correctly. If the error returns, reapply the fix and check the changelog for breaking changes.

Can this error cause data loss?

No, this error occurs before or during an operation and does not corrupt existing files. Claude Code’s edit operations are atomic — they either complete fully or not at all. However, if the error occurs during a multi-step operation, you may have partial changes that need to be reviewed with git diff before continuing.

How do I report this error to Anthropic if the fix does not work?

Open an issue at github.com/anthropics/claude-code with: (1) the full error message including stack trace, (2) your Node.js version (node --version), (3) your Claude Code version (claude --version), (4) your operating system and version, and (5) the command or operation that triggered the error.

This fix also applies if you see variations of this error:

  • Connection or process errors with similar root causes in the same subsystem
  • Timeout variants where the operation starts but does not complete
  • Permission variants where access is denied to the same resource
  • Configuration variants where the same setting is missing or malformed

If your specific error message differs slightly from the one shown above, the fix is likely the same. The key indicator is the operation that failed (shown in the stack trace) rather than the exact wording of the message.

Configure permissions → Build your settings with our Permission Configurator.

Try it: Paste your error into our Error Diagnostic for an instant fix.