Claude Code can't add trailing newline

Resolved 💬 12 comments Opened Feb 27, 2025 by steinerkelvin Closed Jan 20, 2026

Bug Description
Claude Code can't write files with a newline at the end even if explictly instructed to do so.

Environment Info

  • Platform: macos
  • Terminal: kitty
  • Version: 0.2.19
  • Feedback ID: b67373c4-f119-4d1c-8e62-8119531505c2

Transcript:

  1. User asks to create SAMPLE.md with a newline at the end
  2. Claude creates file but without trailing newline
  3. Hex dump confirms missing newline (ends with "2e" which is ".")
  4. Multiple attempts to add the newline using Replace tool fail
  5. Command verification with tail -c 1 SAMPLE.md | xxd -p shows "2e" after each attempt

View original on GitHub ↗

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