[Bug] Edit tool strips trailing whitespace, breaking Markdown line breaks
Bug Description
Title: Edit tool strips trailing whitespace, breaking Markdown line breaks
Description:
The Edit tool automatically strips trailing whitespace from lines before writing to files. This breaks Markdown formatting where two trailing spaces are required for soft line breaks.
Example use case:
User stories with WHEN/THEN acceptance criteria format:
- WHEN condition,
THEN result.
The two spaces after the comma are required for proper rendering in Markdown preview, but the Edit tool removes them.
Expected behavior:
Preserve trailing whitespace as provided in the new_string parameter.
Workaround:
Users must manually add trailing spaces in their IDE after Claude Code edits the file.
Environment Info
- Platform: darwin
- Terminal: phpstorm
- Version: 2.1.1
- Feedback ID: 95d9f7b1-fb42-44a2-b249-436f5a82171f
Errors
[{"error":"Error\n at eP (/$bunfs/root/claude:59:1144)\n at <anonymous> (/$bunfs/root/claude:60:10098)\n at emit (node:events:92:22)\n at endReadableNT (internal:streams/readable:861:50)\n at processTicksAndRejections (native:7:39)\n at request (/$bunfs/root/claude:62:2149)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-09T09:37:27.402Z"},{"error":"Error\n at eP (/$bunfs/root/claude:59:1144)\n at <anonymous> (/$bunfs/root/claude:60:10098)\n at emit (node:events:92:22)\n at endReadableNT (internal:streams/readable:861:50)\n at processTicksAndRejections (native:7:39)\n at request (/$bunfs/root/claude:62:2149)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-09T09:37:27.403Z"},{"error":"Error\n at eP (/$bunfs/root/claude:59:1144)\n at <anonymous> (/$bunfs/root/claude:60:10098)\n at emit (node:events:92:22)\n at endReadableNT (internal:streams/readable:861:50)\n at processTicksAndRejections (native:7:39)\n at request (/$bunfs/root/claude:62:2149)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-09T09:37:27.442Z"},{"error":"Error\n at eP (/$bunfs/root/claude:59:1144)\n at <anonymous> (/$bunfs/root/claude:60:10098)\n at emit (node:events:92:22)\n at endReadableNT (internal:streams/readable:861:50)\n at processTicksAndRejections (native:7:39)\n at request (/$bunfs/root/claude:62:2149)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-09T09:37:27.842Z"},{"error":"Error\n at eP (/$bunfs/root/claude:59:1144)\n at <anonymous> (/$bunfs/root/claude:60:10098)\n at emit (node:events:92:22)\n at endReadableNT (internal:streams/readable:861:50)\n at processTicksAndRejections (native:7:39)\n at request (/$bunfs/root/claude:62:2149)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-09T09:37:48.351Z"},{"error":"Error\n at eP (/$bunfs/root/claude:59:1144)\n at <anonymous> (/$bunfs/root/claude:60:10098)\n at emit (node:events:92:22)\n at endReadableNT (internal:streams/readable:861:50)\n at processTicksAndRejections (native:7:39)\n at request (/$bunfs/root/claude:62:2149)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-09T09:37:48.581Z"},{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/jansamek/.local/share/claude/versions/2.1.2 (expected in multi-process scenarios)\n at oXR (/$bunfs/root/claude:2994:2164)\n at PQB (/$bunfs/root/claude:2992:35188)\n at async er7 (/$bunfs/root/claude:2992:38896)\n at async mj (/$bunfs/root/claude:2994:236)\n at async <anonymous> (/$bunfs/root/claude:2994:14358)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-09T09:37:56.906Z"},{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/jansamek/.local/share/claude/versions/2.1.2 (expected in multi-process scenarios)\n at oXR (/$bunfs/root/claude:2994:2164)\n at PQB (/$bunfs/root/claude:2992:35188)\n at async er7 (/$bunfs/root/claude:2992:38896)\n at async mj (/$bunfs/root/claude:2994:236)\n at async <anonymous> (/$bunfs/root/claude:2994:14358)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-09T09:38:56.124Z"},{"error":"Error: Request was aborted.\n at _createMessage (/$bunfs/root/claude:446:3157)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-09T09:40:34.397Z"},{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/jansamek/.local/share/claude/versions/2.1.2 (expected in multi-process scenarios)\n at oXR (/$bunfs/root/claude:2994:2164)\n at PQB (/$bunfs/root/claude:2992:35188)\n at async er7 (/$bunfs/root/claude:2992:38896)\n at async mj (/$bunfs/root/claude:2994:236)\n at async <anonymous> (/$bunfs/root/claude:2994:14358)\n at processTicksAndRejections (native:7:39)
Note: Error logs were truncated.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗