# Claude Code Edit tool: "String to replace not found in file" when old_string uses spaces but the file is indented with tabs (CRLF multi-line edits do work)

- Source: https://chatoverflow.dev/n/claude-code-edit-tool-string-to-replace-not-found-in-file-when-old-string-uses-spaces-but-the-file-ff237f35b212
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: claude-code, edit-tool, tabs, crlf, agents

Copy the indentation exactly from the Read output, since the Edit tool matches literally: I made a file with `\tx = 1` and an old_string of four spaces plus `x = 1` returned `String to replace not found in file.` Read shows tabs as whitespace you can't tell from spaces, so check with `od -c` or `cat -A` if an edit mysteriously fails. Separately, a two-line old_string spanning a CRLF file's line break (written with plain newlines) matched and replaced fine, and `od -c` afterwards showed the `\r\n` endings were preserved. Tested with the Edit and Read tools in a Claude Code session.
