Conversation Compaction Failure: Unexpected Error When Attempting to Reduce Context Length

Resolved 💬 16 comments Opened Aug 1, 2025 by Electro-Jam Closed Jan 22, 2026

Bug Description
I restarted a conversation and then I asked the system to reneable a set of flags and work forward from what would be next for this effort and then I got the message:\
\
Context low · Run /compact to compact & continue\
\
So I asked it to /compact \
\
Then go this:\
Error: Error during compaction: Error: Conversation too long. Press esc to go up a few messages and try again.\
\
Not sure what to do from here, but I would not expect this type of response from asking the system to do a /compact .. expecially when the system asked me to do so.

Environment Info

  • Platform: win32
  • Terminal: vscode
  • Version: 1.0.65
  • Feedback ID: 902f5297-5edb-49b1-91c1-cb1e8fff33d7

Errors

[{"error":"Error: Tool exit_plan_mode not found\n    at nvB (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2626:3618)\n    at XR (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:65:19859)\n    at Nb (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:42848)\n    at $b (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:38369)\n    at eS (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:38297)\n    at jR (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:38151)\n    at LK (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:35214)\n    at T8 (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:65:4841)\n    at U3 (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:32459)\n    at A.Q.updateContainer (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:71:1837)","timestamp":"2025-08-01T01:07:53.335Z"},{"error":"Error: Tool exit_plan_mode not found\n    at nvB (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2626:3618)\n    at XR (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:65:19859)\n    at Nb (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:42848)\n    at $b (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:38369)\n    at eS (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:38297)\n    at jR (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:38151)\n    at LK (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:35214)\n    at T8 (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:65:4841)\n    at U3 (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:32459)\n    at A.Q.updateContainer (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:71:1837)","timestamp":"2025-08-01T01:07:53.384Z"},{"error":"Error: Tool exit_plan_mode not found\n    at nvB (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2626:3618)\n    at XR (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:65:19859)\n    at Nb (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:42848)\n    at $b (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:38369)\n    at eS (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:38297)\n    at jR (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:38151)\n    at LK (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:35214)\n    at T8 (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:65:4841)\n    at U3 (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:67:32459)\n    at A.Q.updateContainer (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:71:1837)","timestamp":"2025-08-01T01:07:53.481Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at VX (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:1576:1184)\n    at file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:1576:912\n    at Array.map (<anonymous>)\n    at KX (file:///C:/Users/direc/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:1576:903)\n    at Mx1 (file:///C:/Users/direc/AppData/Ro

Note: Error logs were truncated.

View original on GitHub ↗

16 Comments

github-actions[bot] · 11 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/2038
  2. https://github.com/anthropics/claude-code/issues/4888
  3. https://github.com/anthropics/claude-code/issues/2964

If your issue is a duplicate, please close it and 👍 the existing issue instead.

🤖 Generated with Claude Code

ryanmmmmm · 11 months ago

I get same issue. This is super annoying. like stop using claude code annoying imm even using subagents

bedeleu · 11 months ago

I lost all work for few hours in same way - all files reverted and all new files lost. I stop also using cursor till this issue is fixed - pointless !!

cwenner · 10 months ago

It seems to be a bug. If going back a single query does not help, try exiting Claude, resuming the conversation, and running compact again.

bedeleu · 10 months ago

Ok - thanks

AB Solutions Timisoara
ing.Bedeleu Alexandru
+40 728-442.399
@.***

On Fri, Sep 12, 2025 at 11:18 AM Cenny @.***> wrote:

cwenner left a comment (anthropics/claude-code#4890) <https://github.com/anthropics/claude-code/issues/4890#issuecomment-3284251641> It seems to be a bug. If going back a single query does not help, try exiting Claude, resuming the conversation, and running compact again. — Reply to this email directly, view it on GitHub <https://github.com/anthropics/claude-code/issues/4890#issuecomment-3284251641>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AHTHXTEJ6YV7PPFA2INTIHL3SJ6WFAVCNFSM6AAAAACC3NGFFWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBUGI2TCNRUGE> . You are receiving this because you commented.Message ID: @.***>
github-actions[bot] · 7 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

brotherfry · 7 months ago

Still a problem

Electro-Jam · 7 months ago

What is happening for me is that I am having long-running sessions and the files for going back to an old session get to large and I get this message:

<local-command-stderr>Error: Error during compaction: Error: Conversation too long. Press esc twice to go up a few messages and try again.</local-command-stderr>

This happens both when i'm using the console with --continue for a couple of days and, for the same reason, when I use the CLI streaming interface. It seems that, fo rme on Windows, once the files for history get to long and i've sent "too large" of messages I get stuck in this state.

Further note: I do get this usually just before all of this starts to fail:
"Prompt is too long"
Sometimes I can use a /compact and keep going
Then at some point I'll get the above error.

Please let me know if there are other logs I can get for you to help debug and/or fix this. To me, this is always bad because i'm in the middle of doing work and now I have to do a full session restart and I loose all of the session and that takes a while to get back to the proper conversation / context to keep working.

Electro-Jam · 7 months ago

I wanted to note that I have hit this now 3 times today.
For me this is a major workflow issue for recovering - would be happy to share any info that is needed to fix this.

Electro-Jam · 7 months ago

here is an example:

Electro-Jam · 7 months ago

Here is what I had another agent session go and look at so that you have it for reference.

SESSION FILES (Non-Agent)

| File | Size | Modified | Last Accessed |
|------|------|----------|---------------|
| 2646b07b-*.jsonl | 3.2KB | 2025-11-28 | 2025-12-13 |
| cb53e680-*.jsonl | 18.3MB | 2025-11-29 | 2025-12-13 |
| 669cc5d7-*.jsonl | 10.8MB | 2025-11-29 | 2025-12-13 |
| 7b63926e-*.jsonl | 2.8MB | 2025-11-29 | 2025-12-13 |
| 827fd434-*.jsonl | 1.9MB | 2025-11-29 | 2025-12-13 |
| 6a9223bd-*.jsonl | 1.6MB | 2025-11-29 | 2025-12-13 |
| 6ce2967a-*.jsonl | 1.1MB | 2025-11-29 | 2025-12-13 |
| 387352a6-*.jsonl | 1.3MB | 2025-11-30 | 2025-12-13 |
| 2108f6b3-*.jsonl | 114.9KB | 2025-11-30 | 2025-12-13 |
| 91fd8467-*.jsonl | 2.3MB | 2025-12-02 | 2025-12-13 |
| 6102996b-*.jsonl | 2.3MB | 2025-12-03 | 2025-12-13 |
| c04498ef-*.jsonl | 6.6MB | 2025-12-06 | 2025-12-13 |
| 9e7cb7f2-*.jsonl | 1.9MB | 2025-12-06 | 2025-12-13 |
| 65d158cf-*.jsonl | 4.4MB | 2025-12-10 | 2025-12-13 |
| 593c2d88-*.jsonl | 520KB | 2025-12-10 | 2025-12-13 |
| 739138b3-*.jsonl | 1.8KB | 2025-12-10 | 2025-12-13 |
| 458dd3c9-*.jsonl | 4.3MB | 2025-12-11 | 2025-12-13 |
| c9d3e31c-*.jsonl | 4.9MB | 2025-12-11 | 2025-12-13 |
| cc9b1169-*.jsonl | 10.2MB | 2025-12-13 | 2025-12-13 |
| 526391b8-*.jsonl | 4.9MB | 2025-12-13 | 2025-12-13 |
| 8842322f-*.jsonl | 2.8MB | 2025-12-13 | 2025-12-13 |
| 14a8d698-*.jsonl | 3.2MB | 2025-12-13 | 2025-12-13 |

Oldest file: agent-fe927874.jsonl from Nov 27, 2025

Largest files (candidates for deletion):

  1. cb53e680-*.jsonl - 18.3MB (Nov 29)
  2. 669cc5d7-*.jsonl - 10.8MB (Nov 29)
  3. cc9b1169-*.jsonl - 10.2MB (Dec 13 - recent!)

Recommended cleanup:

  • Delete 14 empty files → saves nothing but cleans directory
  • Delete all agent files → saves ~43MB
  • Delete sessions before Dec 10 → saves ~50MB more

After having the agent run the cleanup:

BEFORE vs AFTER CLEANUP

| Metric | Before | After | Change |
|--------|--------|-------|--------|
| Total Size | 128MB | 36MB | -92MB (72% reduction) |
| Agent Files | 215 | 0 | -215 files |
| Session Files | 36 | 9 | -27 files |
| Empty Files | 14 | 0 | -14 files |
| Total Files | 251 | 9 | -242 files |

---

WHAT WAS DELETED

| Category | Count | Size Freed |
|----------|-------|------------|
| Agent files (subagent histories) | 215 | ~43MB |
| Empty session files (0 bytes) | 14 | 0MB |
| Old sessions (before Dec 10) | 13 | ~49MB |
| TOTAL DELETED | 242 | ~92MB |

---

REMAINING FILES (9 sessions)

| File | Size | Date |
|------|------|------|
| 739138b3-*.jsonl | 1.9KB | Dec 10 |
| 593c2d88-*.jsonl | 520KB | Dec 10 |
| 65d158cf-*.jsonl | 4.5MB | Dec 10 |
| 458dd3c9-*.jsonl | 4.4MB | Dec 11 |
| c9d3e31c-*.jsonl | 5.0MB | Dec 11 |
| 14a8d698-*.jsonl | 3.2MB | Dec 13 |
| 526391b8-*.jsonl | 4.9MB | Dec 13 |
| 8842322f-*.jsonl | 2.9MB | Dec 13 |
| cc9b1169-*.jsonl | 11MB | Dec 13 |

All recent work (Dec 10-13) is preserved. The "too long" error should be resolved now.

When I restarted the session, via the --continue I got this message:
"Prompt is too long"
I then ran the /compact
The compact was successful.

Somehow the older logs or larger agent file logs are causing issues with the system over time. This issue is now the 3rd time today and I wanted to give some more info here to see if it would be of help.

Electro-Jam · 7 months ago

another possible note for the team:
I am using the CLI streaming and it looks like I was able to send "to long" of a single message through the CLI interface, once this happened the system got stuck in the state where it would reply after I sent a message and say "message to long" (something close to that). The only way was to delete the current session file -- and yes lost work this time -- but I think it may be, at least in my case, an issue when sending to long of a prompt via the CLI streaming interface.

osakanights · 6 months ago

Having an issue with this too

github-actions[bot] · 5 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

marcindulak · 5 months ago

This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.