[Bug] Edit tool fails to write files with the edit tool
Bug Description
Diagnostics
└ Currently running: native (2.1.81)
└ Path: /home/greg/.local/share/claude/versions/2.1.81
└ Invoked: /home/greg/.local/share/claude/versions/2.1.81
└ Config install method: native
└ Search: OK (bundled)
Updates
└ Auto-updates: enabled
└ Auto-update channel: latest
└ Stable version: 2.1.74
└ Latest version: 2.1.81
Version Locks
└ 2.1.81: PID 2220674 (running)
CC reported it was unable to write with its edit tool.
It switched to Bash and text strings with <<EOF
My workflow is to have a repo and next to it workspaces. Then I have versioned directories below workspaces that I copy to the next version and put either, the old way, tarballs from Claude.ai, or, since the big change a month ago, just files and it sends me grep and sed commands, as Claude's context has become a precious commodity.
Something locally has been overwriting the new code CC has been generating with unmodified code.
We suspected VS Code, but it happens when that is not running.
CC looked for other processes that might affect the file system but found none.
Between Claude.ai and CC we decided that it must be an aberrant behavior coming from CC.
The overwrites don't happen with just the Claude.ai workflow.
Claude.ai said to include:
CC version: 2.1.81
OS: Ubuntu 24.04
The Edit tool reports success but doesn't write when file contains emoji/em-dash characters
Workaround: Python via Bash with Unicode escapes works correctly
inotifywait and auditd confirmed no write events despite "success" report
I hope this helps (and I hope I'm not the only one reporting this).
V/r,
Greg Hering
Environment Info
- Platform: linux
- Terminal: gnome-terminal
- Version: 2.1.81
- Feedback ID: d1f0bfc4-a4f5-4d53-85c4-27f197e73b2b
Errors
"display":"Please run \"grep -n \"copy_btn\\|extract_btn\\|btn_row\" /home/greg/Projects/spacemind/workspaces/27.56/launcher/ui_tiles.py\"","pastedContents":{},"timestamp":1774232277624,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"[Pasted text #1 +3 lines]","pastedContents":{"1":{"id":1,"type":"text","content":" lines 205–210 are unchanged. CC's ui_tiles.py edit failed silently too, same as workspace.py did the first time. Have CC run the same line-number Python insertion approach it used successfully for workspace.py, and then immediately verify with:\nbashgrep -n \"extract_btn\\|btn_row\\|_run_copy_prev\\|_run_copy_extract\" /home/greg/Projects/spacemind/workspaces/27.56/launcher/ui_tiles.py\nIf that comes back empty again, something is actively resetting that file. At that point have CC check the mtime before and after the write:\nbashstat /home/greg/Projects/spacemind/workspaces/27.56/launcher/ui_tiles.py"}},"timestamp":1774232695475,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"Something must be, because I ran launcher and saw the two buttons, but they are back to one button now.","pastedContents":{},"timestamp":1774232971809,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"I'm installing it inotifywait. Hold on. Plus web claude says: let's get the good code into the file independently. Have CC write the corrected ui_tiles.py block to a separate file outside the workspace:\nbashcat /tmp/ui_tiles_patch.py\nThen we can diff it against what's actually in the workspace and do a manual cp if needed. That way we can see exactly what's diverging and whether something is actively reverting it.","pastedContents":{},"timestamp":1774233619613,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"Okay, modify both files and write them to tmp. Actually, I see ui_tiles_patched.py there. Is that yours? If so do the other one and also WC told me to shut down VS Code, just to be safe.","pastedContents":{},"timestamp":1774234126473,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"I DID shut it down. You should not have reversions anymore, if in fact VS Code was the culprit. And I'm seeing two buttons in the current launcher code, so maybe the workspace is right and /tmp is wrong.","pastedContents":{},"timestamp":1774235455751,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"We are back to one button. Can you not see that in the code?","pastedContents":{},"timestamp":1774235686180,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"Okay, I have inotify wait with -m and -e close_write on workspace.py and ui_tiles.py but I am not seeing anything triggering them. Do you want me to start the launcher now?","pastedContents":{},"timestamp":1774236242060,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"It must have secretly reset. Look at the startup output: ./launcher_app.py [Pasted text #1 +12 lines]","pastedContents":{"1":{"id":1,"type":"text","content":"Traceback (most recent call last):\n File \"/home/greg/Projects/spacemind/workspaces/27.56/./launcher_app.py\", line 19, in <module>\n main()\n File \"/home/greg/Projects/spacemind/workspaces/27.56/launcher/ui_main.py\", line 747, in main\n window = SpaceMindLauncher()\n ^^^^^^^^^^^^^^^^^^^\n File \"/home/greg/Projects/spacemind/workspaces/27.56/launcher/ui_main.py\", line 560, in __init__\n self.setup_ui()\n File \"/home/greg/Projects/spacemind/workspaces/27.56/launcher/ui_tiles.py\", line 211, in setup_ui\n self.copy_btn.clicked.connect(self._run_copy_prev)\n ^^^^^^^^^^^^^^^^^^^\nAttributeError: 'SpaceMindLauncher' object has no attribute '_run_copy_prev'\n"}},"timestamp":1774236300635,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"You just got a close write, close but that's from you, yes?","pastedContents":{},"timestamp":1774236439922,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"I just started and closed the launcher three times. No notifications and I have two buttons (but they are still not right).","pastedContents":{},"timestamp":1774236569297,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"Maybe it's the tests!","pastedContents":{},"timestamp":1774236726174,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"I think the tests themselves are doing the damage. We need to modify the tests so they never touch 27.56/launcher directly. [Pasted text #2 +3 lines]","pastedContents":{"2":{"id":2,"type":"text","content":"tmp_path is the pytest-blessed way — it creates a fresh temp directory per test and cleans it up automatically.\nHave CC show you what the fixture is currently doing:\nbashgrep -n \"copytree\\|rmtree\\|launcher\\|workspace\\|tmp\" /home/greg/Projects/spacemind/workspaces/27.56/tests/conftest.py | head -30\nThen we'll know exactly what needs to change. This is worth fixing properly before closing the session — it's been silently corrupting your workspace on every test run."}},"timestamp":1774237005788,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"Yes, quiet.","pastedContents":{},"timestamp":1774237660757,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"Please.","pastedContents":{},"timestamp":1774237686748,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
"display":"What files did you touch? Give me a list.","pastedContents":{},"timestamp":1774237783539,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"The files changes are gone again. Do you have complete copies in /tmp?","pastedContents":{},"timestamp":1774239075773,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"I don't think I want to run the tests right now. Did you copy them to tmp as well?","pastedContents":{},"timestamp":1774239971954,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"I would expect you to write them to tmp and copy to 27.56 after all the trouble we've been having.","pastedContents":{},"timestamp":1774240011972,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"Okay, I'm going to run the launcher now.","pastedContents":{},"timestamp":1774240113744,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"I don't see anything from inotifywait. I did get these errors on the consose, about 20-30 of them: Could not parse stylesheet of object QPushButton(0x42caca0)","pastedContents":{},"timestamp":1774240225935,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"Write to tmp. Copy to 27.56. You did it backwards. If something corrupted your file in 27.56 you would have just erased your backup. Unless you also timestamp the backups...","pastedContents":{},"timestamp":1774240401837,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"Good job. It looks like the buttons are colored now too!","pastedContents":{},"timestamp":1774240515605,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"It looks good.","pastedContents":{},"timestamp":1774240638211,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"exit","pastedContents":{},"timestamp":1774280654630,"project":"/home/greg/Projects/spacemind/repo","sessionId":"4ef0cf73-a386-452a-9dc2-37920f4431b1"}
{"display":"/doctor","pastedContents":{},"timestamp":1774321645195,"project":"/tmp/pytest-of-greg/pytest-119","sessionId":"540fe716-fc63-4cd4-a997-b31c60c26b2e"}
We eliminated VS Code, CC tried to find processes that might be running that would effect the files, and finally I shut down CC and asked the web Claude to do it all.
So, at this point I have quit using Claude Code and just used Claude.ai with greps/seds and pasting into my files manually.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗