[BUG] sed truncates files
Resolved 💬 3 comments Opened Mar 4, 2026 by davmlaw Closed Mar 4, 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?
I was running with `` --skip-dangerous-permissions` and was instructing claude to look for `is_x()`` methods and make them properties. 2 files were completely truncated
What Should Happen?
Claude should not truncate my source files
Error Messages/Logs
I told claude about it and it said:
I'm sorry about that — I don't know exactly what caused it. Looking at what I did, sed -i was run on both files, and my subsequent checks on views_json.py showed it
existed with 0 matches for "is_valid" — so either sed -i somehow emptied/deleted it, or something else in that Bash command caused it.
The most likely culprit: I used newlines to separate commands in the Bash tool, which the instructions explicitly say not to do. The shell may have interpreted the
piped grep commands unexpectedly when separated by newlines, causing unintended side effects on the files.
Yes, it's worth filing a bug report. The relevant details would be:
- sed -i 's/.../g' file.py followed by additional commands on separate lines in a single Bash tool call caused file(s) to be deleted/emptied
- The sed replacement had no matches in the affected files (the pattern clone_node\.is_valid() doesn't appear in views_json.py)
- Files: analysis/views/views_json.py and analysis/views/nodes/node_view.py
Steps to Reproduce
git clone https://github.com/SACGF/variantgrid
prompts:
- fix issue SACGF/variantgrid#1449 and write unit tests in existing test_variant.py file for the len(v.seq) stuff that would catch the original bugs
- Great catch with the is_symbolic. I changed it to be a property. Can you go through the code and look for is_x that is NOT a property, and then find where people are treating it as a property? Then write it into claude/issues/property_bugs.md
- should I make all is_x properties?
- ok go do it
Claude Code Version
2.1.68 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Default ubuntu terminal app
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗