[Bug] Bash command context overflow: `! ls -la` in large directory exceeds token limit
Bug Description
Executing the bash command "! ls -la" inside a folder with 8,919 files immediately filled the context from 16% to 300%.
Output from the chat
`❯ /context
⎿ Context Usage
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ claude-opus-4-5-20251101 · 31k/200k tokens (16%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System prompt: 3.0k tokens (1.5%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System tools: 16.7k tokens (8.4%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Messages: 11.7k tokens (5.9%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ Free space: 124k (61.8%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛝ Autocompact buffer: 45.0k tokens (22.5%)
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛝ ⛝ ⛝
⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝
⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝
! ls -la
⎿ total 1166708
drwxrwxr-x 2 user user 708608 Jan 15 11:14 .
drwxrwxr-x 9 user user 4096 Jan 15 13:32 ..
… +8919 lines (ctrl+o to expand)
❯ /context
⎿ Context Usage
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ claude-opus-4-5-20251101 · 599k/200k tokens (300%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ System prompt: 3.0k tokens (1.5%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ System tools: 16.7k tokens (8.4%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ Messages: 579.6k tokens (289.8%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛝ Autocompact buffer: 45.0k tokens (22.5%)
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁
⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁
`
Environment Info
- Platform: linux
- Terminal: vte-based
- Version: 2.1.7
- Feedback ID: 2cac2e1f-e574-4131-b695-63302e992c30
Errors
[{"error":"Error: EISDIR: illegal operation on a directory, read\n at readFileSync (unknown)\n at <anonymous> (/$bunfs/root/claude:12:562)\n at rF (/$bunfs/root/claude:11:34565)\n at readFileSync (/$bunfs/root/claude:12:521)\n at GyI (/$bunfs/root/claude:4636:24009)\n at call (/$bunfs/root/claude:1615:945)\n at call (/$bunfs/root/claude:1611:6443)\n at PA1 (/$bunfs/root/claude:3072:17932)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-15T12:29:13.150Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 206521 tokens > 200000 maximum\"},\"request_id\":\"req_011CX9AfGBZ5CAvgMdjTbBvp\"}\n at generate (/$bunfs/root/claude:438:33630)\n at makeRequest (/$bunfs/root/claude:855:5435)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-15T12:31:10.150Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 204767 tokens > 200000 maximum\"},\"request_id\":\"req_011CX9Bxox6XL5Q9CHnCDVi8\"}\n at generate (/$bunfs/root/claude:438:33630)\n at makeRequest (/$bunfs/root/claude:855:5435)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-15T12:48:14.987Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 205066 tokens > 200000 maximum\"},\"request_id\":\"req_011CX9Bxq7JGcW92FN79L7dT\"}\n at generate (/$bunfs/root/claude:438:33630)\n at makeRequest (/$bunfs/root/claude:855:5435)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-15T12:48:15.260Z"},{"error":"SyntaxError: JSON Parse error: Expected '}'\n at <parse> (:0)\n at parse (unknown)\n at <anonymous> (/$bunfs/root/claude:76:708)\n at A (/$bunfs/root/claude:11:7260)\n at uRI (/$bunfs/root/claude:1596:3097)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-15T12:48:15.261Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 226738 tokens > 200000 maximum\"},\"request_id\":\"req_011CX9C13yGUTaEjXUXVt1f5\"}\n at generate (/$bunfs/root/claude:438:33630)\n at makeRequest (/$bunfs/root/claude:855:5435)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-15T12:48:45.438Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 224443 tokens > 200000 maximum\"},\"request_id\":\"req_011CX9CKrWy2L7FT37KxV3wR\"}\n at generate (/$bunfs/root/claude:438:33630)\n at makeRequest (/$bunfs/root/claude:855:5435)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-15T12:53:00.807Z"},{"error":"Error: Conversation too long. Press esc twice to go up a few messages and try again.\n at q7$ (/$bunfs/root/claude:2940:716)\n at async call (/$bunfs/root/claude:3162:56)\n at async Vx9 (/$bunfs/root/claude:2271:3202)\n at async X9D (/$bunfs/root/claude:2271:1034)\n at async yA1 (/$bunfs/root/claude:3094:2510)\n at async QP$ (/$bunfs/root/claude:3092:3518)\n at async nJ1 (/$bunfs/root/claude:4923:14978)\n at async Rw$ (/$bunfs/root/claude:4923:14138)\n at async <anonymous> (/$bunfs/root/claude:4931:6090)\n at async <anonymous> (/$bunfs/root/claude:4921:4992)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-15T12:53:00.810Z"},{"error":"Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.\n at call (/$bunfs/root/claude:3163:189)\n at async Vx9 (/$bunfs/root/claude:2271:3202)\n at async X9D (/$bunfs/root/claude:2271:1034)\n at async yA1 (/$bunfs/root/claude:3094:2510)\n at async QP$ (/$bunfs/root/claude:3092:3518)\n at async nJ1 (/$bunfs/root/claude:4923:14978)\n at async Rw$ (/$bunfs/root/claude:4923:14138)\n at async <anonymous> (/$bunfs/root/claude:4931:6090)\n at async <anonymous> (/$bunfs/root/claude:4921:4992)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-15T12:53:00.811Z"},{"error":"Error: Request was aborted.\n at makeRequest (/$bunfs/root/claude
Note: Error logs were truncated.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗