[BUG] Edit Tool Cannot Handle Files with Tabs

Resolved 💬 5 comments Opened Dec 5, 2025 by fschwiet Closed Feb 6, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Every time I use Claude it struggles to edit files. The edit tool often breaks down and it ends up writing custom powershell scripts for every edit it needs to make. I asked it why, it said:

You're right to ask! I'm having trouble because of a mismatch between how the Read tool displays file content
  versus the actual bytes in the files. Specifically:

  1. Tab vs Spaces: The Read tool converts tabs to spaces when displaying content, but the actual files use tabs for
   indentation. When I try to match the displayed content in Edit operations, it can't find the exact string because
   I'm matching spaces where tabs exist.
  2. The Edit tool is very strict: It requires EXACT byte-for-byte matching of the "old_string", including exact
  whitespace characters (tabs vs spaces).

I swear 90% of my claude sessions are claude trying to figure out how to edit a C# file.

What Should Happen?

It should be able to use the edit tool to edit files. With regards to indentation it does not need to be precise because I run tools to normalize the formatting (and it has instructions it follows on how to do so in claude.md)

Error Messages/Logs

<tool_use_error>String to replace not found in file.\nString: \t\t\t.WithPaths(\n\t\t\t\t[\n\t\t\t\t\t(\"boy\", \"niño\"),\n\t\t\t\t\t(\"boy\", \"chico\"),\n\t\t\t\t\t(\"boy\", \"muchacho\"),\n\t\t\t\t\t(\"child\", \"hijo\"),\n\t\t\t\t\t(\"child\", \"niño\"),\n\t\t\t\t\t(\"daughter\", \"hijo\"),\n\t\t\t\t\t(\"girl\", \"niño\"),\n\t\t\t\t\t(\"girl\", \"chico\"),\n\t\t\t\t\t(\"girl\", \"muchacho\"),\n\t\t\t\t\t(\"kid\", \"chico\"),\n\t\t\t\t\t(\"kid\", \"niño\"),\n\t\t\t\t\t(\"son\", \"hijo\"),\n\t\t\t\t\t(\"young man\", \"muchacho\"),\n\t\t\t\t\t(\"young woman\", \"muchacho\"),\n\t\t\t\t],\n\t\t\t\t[\n\t\t\t\t\t(\"chico\", \"boy\"),\n\t\t\t\t\t(\"chico\", \"girl\"),\n\t\t\t\t\t(\"chico\", \"kid\"),\n\t\t\t\t\t(\"hijo\", \"child\"),\n\t\t\t\t\t(\"hijo\", \"son\"),\n\t\t\t\t\t(\"muchacho\", \"boy\"),\n\t\t\t\t\t(\"muchacho\", \"girl\"),\n\t\t\t\t\t(\"muchacho\", \"young man\"),\n\t\t\t\t\t(\"muchacho\", \"young woman\"),\n\t\t\t\t\t(\"niño\", \"boy\"),\n\t\t\t\t\t(\"niño\", \"child\"),\n\t\t\t\t\t(\"niño\", \"girl\"),\n\t\t\t\t\t(\"niño\", \"kid\"),\n\t\t\t\t]\n\t\t\t),</tool_use_error>","is_error":true,"tool_use_id":"toolu_01KtwqdSrUiugyPoukHyz9D6"}]},"uuid":"470dbcbf-7d54-4bb7-bed9-dab785d02724","timestamp":"2025-12-05T17:15:46.507Z","toolUseResult":"Error: String to replace not found in file.\nString: \t\t\t.WithPaths(\n\t\t\t\t[\n\t\t\t\t\t(\"boy\", \"niño\"),\n\t\t\t\t\t(\"boy\", \"chico\"),\n\t\t\t\t\t(\"boy\", \"muchacho\"),\n\t\t\t\t\t(\"child\", \"hijo\"),\n\t\t\t\t\t(\"child\", \"niño\"),\n\t\t\t\t\t(\"daughter\", \"hijo\"),\n\t\t\t\t\t(\"girl\", \"niño\"),\n\t\t\t\t\t(\"girl\", \"chico\"),\n\t\t\t\t\t(\"girl\", \"muchacho\"),\n\t\t\t\t\t(\"kid\", \"chico\"),\n\t\t\t\t\t(\"kid\", \"niño\"),\n\t\t\t\t\t(\"son\", \"hijo\"),\n\t\t\t\t\t(\"young man\", \"muchacho\"),\n\t\t\t\t\t(\"young woman\", \"muchacho\"),\n\t\t\t\t],\n\t\t\t\t[\n\t\t\t\t\t(\"chico\", \"boy\"),\n\t\t\t\t\t(\"chico\", \"girl\"),\n\t\t\t\t\t(\"chico\", \"kid\"),\n\t\t\t\t\t(\"hijo\", \"child\"),\n\t\t\t\t\t(\"hijo\", \"son\"),\n\t\t\t\t\t(\"muchacho\", \"boy\"),\n\t\t\t\t\t(\"muchacho\", \"girl\"),\n\t\t\t\t\t(\"muchacho\", \"young man\"),\n\t\t\t\t\t(\"muchacho\", \"young woman\"),\n\t\t\t\t\t(\"niño\", \"boy\"),\n\t\t\t\t\t(\"niño\", \"child\"),\n\t\t\t\t\t(\"niño\", \"girl\"),\n\t\t\t\t\t(\"niño\", \"kid\"),\n\t\t\t\t]\n\t\t\t),"}
{"parentUuid":"470dbcbf-7d54-4bb7-bed9-dab785d02724","isSidechain":false,"userType":"external","cwd":"C:\\code\\fschwiet-spanish","sessionId":"2c6c82d8-dc7f-4570-9c6d-3f5a7e32ef61","version":"2.0.58","gitBranch":"master","slug":"hazy-sparking-kettle","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01Lx7cPUHwFv2tHGPwA3bZ6i","type":"message","role":"assistant","content":[{"type":"text","text":"Let me check the indentation more carefully:"}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":6,"cache_creation_input_tokens":1019,"cache_read_input_tokens":32334,"cache_creation":{"ephemeral_5m_input_tokens":1019,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}},"requestId":"req_011CVovCUeUWz4cTBydLzJrK","type":"assistant","uuid":"8e06421a-e7cd-4e38-8bac-d85f889ae707","timestamp":"2025-12-05T17:15:49.626Z"}
{"parentUuid":"8e06421a-e7cd-4e38-8bac-d85f889ae707","isSidechain":false,"userType":"external","cwd":"C:\\code\\fschwiet-spanish","sessionId":"2c6c82d8-dc7f-4570-9c6d-3f5a7e32ef61","version":"2.0.58","gitBranch":"master","slug":"hazy-sparking-kettle","message":{"model":"claude-sonnet-4-5-20250929","id":"msg_01Lx7cPUHwFv2tHGPwA3bZ6i","type":"message","role":"assistant","content":[{"type":"tool_use","id":"toolu_01Dy5uQLEX5SCKwjzMoakoLF","name":"Bash","input":{"command":"cat \"C:\\code\\fschwiet-spanish\\LanguageCore\\Corpora\\DefaultPeopleCorpus.cs\" | Select-Object -Skip 158 -First 33","description":"View exact content with proper indentation"}}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":6,"cache_creation_input_tokens":1019,"cache_read_input_tokens":32334,"cache_creation":{"ephemeral_5m_input_tokens":1019,"ephemeral_1h_input_tokens":0},"output_tokens":128,"service_tier":"standard"}},"requestId":"req_011CVovCUeUWz4cTBydLzJrK","type":"assistant","uuid":"2de6dfa9-8e7c-480d-b9de-70ed4346176a","timestamp":"2025-12-05T17:15:50.921Z"}
{"parentUuid":"2de6dfa9-8e7c-480d-b9de-70ed4346176a","isSidechain":false,"userType":"external","cwd":"C:\\code\\fschwiet-spanish","sessionId":"2c6c82d8-dc7f-4570-9c6d-3f5a7e32ef61","version":"2.0.58","gitBranch":"master","slug":"hazy-sparking-

Steps to Reproduce

  1. Nahh fam I see people have opened this issue already and had the issue autoclosed despite providing repro instructions
  2. Try to reproduce it yourself and let me know what steps you followed to not see the issue.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.59

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

This looks to be related to https://github.com/anthropics/claude-code/issues/7197 where the a multi-edit tool is having problems but that issue was closed automatically. https://github.com/anthropics/claude-code/issues/968 looks similar as well that issue was also autoclosed for inactivity.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗