Preflight Checklist
What's Wrong?
- Result: String to replace not found in file error
- Convert tabs to spaces in the file manually, then the same Edit call succeeds
Expected Behavior:
One of these solutions:
Option 1: Edit tool should normalize whitespace (treat tabs and spaces as equivalent when matching)
Option 2: Read tool should explicitly show tabs vs spaces (like cat -A does)
Option 3: Provide a way to query file's whitespace style before editing
Actual Behavior:
- Read tool displays tabs and spaces identically
- Edit tool requires exact byte-for-byte match including whitespace
- No way to determine if file uses tabs or spaces
- User must guess or use bash commands to check
Impact:
- High - Edit tool is unusable on tab-indented files without manual conversion
- Many codebases use tabs (Python legacy code, Makefiles, Go, etc.)
- Forces unnecessary whitespace changes just to make edits
Workaround:
Currently must either:
- Convert entire file to spaces temporarily
- Use bash sed/awk commands instead of Edit tool
- Manually edit in IDE
Additional Context:
The error message doesn't mention whitespace mismatch, making it hard to diagnose.
What Should Happen?
The Edit tool fails to match strings in files that use tabs for indentation, even when the content is identical.
Error Messages/Logs
Steps to Reproduce
- Create a Python file with tab indentation:
File uses tabs (\t) for indentation
def example():
if True:
return "test"
- Use Read tool to view the file - it shows the content but doesn't indicate tabs vs spaces
- Try to use Edit tool with the exact visible content:
def example():
if True:
return "test"
def example():
if True:
return "modified"
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
No response
Claude Code Version
2
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
No response
Preflight Checklist
What's Wrong?
Expected Behavior:
One of these solutions:
Option 1: Edit tool should normalize whitespace (treat tabs and spaces as equivalent when matching)
Option 2: Read tool should explicitly show tabs vs spaces (like cat -A does)
Option 3: Provide a way to query file's whitespace style before editing
Actual Behavior:
Impact:
Workaround:
Currently must either:
Additional Context:
The error message doesn't mention whitespace mismatch, making it hard to diagnose.
What Should Happen?
The Edit tool fails to match strings in files that use tabs for indentation, even when the content is identical.
Error Messages/Logs
Steps to Reproduce
File uses tabs (\t) for indentation
def example():
if True:
return "test"
- Use Read tool to view the file - it shows the content but doesn't indicate tabs vs spaces
- Try to use Edit tool with the exact visible content:
def example(): if True: return "test" def example(): if True: return "modified"Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
No response
Claude Code Version
2
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
No response