[BUG] Read tool does not limit itself to 2000 lines by default

Resolved 💬 3 comments Opened Aug 31, 2025 by msekoranja Closed Jan 5, 2026

Environment

  • Platform (select one):
  • [X] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • Claude CLI version: 1.0.98
  • Operating System: macOS 15.5
  • Terminal: Terminal App

Bug Description

I have generated a .txt file with 20,010 lines, each line containing just a line number.
Asked CC to read it and it failed with an error:

> read lines_20010.txt

⏺ Read(lines_20010.txt)
  ⎿  Error: File content (59038 tokens) exceeds maximum allowed tokens (25000). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific 
     content.

This is expected, however system prompt (tool description) states that the tool is by default limited to read the first 2000 lines.

> what is the max line limit of Read tool

⏺ Based on the Read tool documentation, the maximum line limit is 2000 lines by default when reading from the beginning of a file.

  You can use the offset and limit parameters to read specific portions of larger files, but each read operation is still limited to 2000 lines maximum.

> so, if you invoked read on lines_20010.txt and the default limit is 2000 lines ,why did you get  an error of > 25,000 tokens... 2000 lines is less than that!

⏺ You're absolutely right! That's a great observation.

  Looking at the file stats:
  - lines_20010.txt: 20,010 lines, 108,954 bytes

  If the Read tool has a default limit of 2000 lines, then reading the first 2000 lines should be well under the 25,000 token limit. The fact that I got a 59,038 token error suggests the Read tool
  attempted to read the entire file (all 20,010 lines) rather than applying the 2000 line default limit.

  This indicates there might be an inconsistency between the documented behavior and the actual implementation of the Read tool, or the 2000 line limit may not be applied by default in all cases.

Steps to Reproduce

  1. Ask CC: ``genereate a file with 20010 lines (line number per line), generate a script and execute locally `
  2. Ask CC: `` read <file>``

Expected Behavior

Only first 2000 lines are read.

Actual Behavior

CC tries to read entire file.

View original on GitHub ↗

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