[BUG] Read tool incorrectly reports "No newline at end of file" when newline exists

Resolved 💬 3 comments Opened Jul 2, 2025 by smythp Closed Nov 30, 2025

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.40 (Claude Code)
  • Operating System: Ubuntu 24.04.1
  • Terminal: Claude Code CLI

Bug Description

The Read tool incorrectly reports "No newline at end of file" in
system reminders when files are properly terminated with a newline
character.

## Steps to Reproduce

  1. Use the Read tool on a file that ends with a newline character
  2. Observe the system reminder message that appears after the file

content

Expected Behavior

No warning about missing newline when the file is properly terminated

Actual Behavior

System reminder incorrectly shows:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
42→ No newline at end of file

## Additional Context
Verification with tail -c 10 /path/to/file.txt | od -c shows:
0000000 e l i t . \n
0000006
The \n character is clearly present, confirming this is a false
warning from the Read tool.

View original on GitHub ↗

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