GeezerVison is showing github.com — prompt is too long unrecoverable · Issue #4845 · anomalyco/opencode
prompt is too long unrecoverable #4845DescriptionDescription
Opencode with Opus 4.5 often gives me prompt is too long: 209549 tokens > 200000 maximum. This is completely unrecoverable, short of rolling back the session or forking and you then need to compact or something.
Note I'm only at: 121,480 61% ($5.62)
OpenCode version
1.0.119
Steps to reproduce
Use Antropic api key with Opus 4.5, trigger a huge search for example in the primary agent.
Screenshot and/or share link
No response
Operating System
macos
Terminal
ghostty Reacted by Stanislas, Andrew Sullivan, Albert Borsos, Seppo Puusa, Ben Vargas, Emilio Marin, Craig de Gouveia, David Carey, Carlton Aikins, Tommy D. Rossi and 9 more Reacted by aaronnewsome and Carlton Aikins Activitygithub-actions commented on Nov 27, 2025 This issue might be a duplicate of existing issues. Please check:
All these issues share the same core problem: context window overflow leading to unrecoverable sessions. Feel free to ignore if your case has specific differences! menoatree commented on Dec 12, 2025 I had this happen today aswell when the main agent tried to webfetch the openrouter model list
% WebFetch https://openrouter.ai/api/v1/models
prompt is too long: 206917 tokens > 200000 maximum
Nindaleth commented on Dec 18, 2025 @menoatree That URL returns over 450 kB of data for me, that must be around 100,000 tokens of context. ben-vargas commented on Dec 19, 2025 Yeah, see that #5360 issue where i added comments, there are tool calls like webfetch and mcp tools that are not truncated and if the source being webfetched or mcp tool scraped with something like firecrawl, it can easily cause the context window to be exceeded which results in this error with opus 4.5. thdxr commented on Dec 30, 2025 will be fixing this next week Reacted by jcarin, Ben Grynhaus, Justin Carlson, Ben Williams, Andrii Shafar, Jin Li, Harsha Goli and Leon Meijer Reacted by Mudit Mahajan, Justin Carlson, Conny Brunnkvist, Andrii Shafar and Jin Li PeterHa-UoH commented on Jan 6, 2026
will be fixing this next week
has it been fixed yet/ Reacted by Carlos Gratacos Nindaleth commented on Jan 6, 2026 @PeterHa-UoH
rekram1-node closed this as completed in #6480 5 days ago
I would say yes, but feel free to try it on your own Reacted by Carlos Gratacos miguelangelmorenochacon commented on Feb 10, 2026 Reacted by ff34wf, Ashay Changwani and Ryan Massive ashaychangwani commented on Feb 11, 2026 Can we please reopen this issue? A lot of people are reporting the same in #5360 rekram1-node commented on Feb 11, 2026 I found some places we had issues, fixing Reacted by Julien Etienne, Boris Chumichev and Tekeste Gebreanenia daheli commented on Feb 13, 2026 smashah commented on Feb 14, 2026 The whole payload seems to be filled with tool definitions ogyr commented on Feb 14, 2026 Same problem here with opus 4.6
/compact fails as well. I could live with a simple "How much of the oldest content do you want to trim? In k tokens" iamtekeste commented on Feb 15, 2026 Is there a workaround in the meantime? ogyr commented on Feb 15, 2026 I created https://github.com/ogyr/opencode-cullto today as a workaround. It lets you cull your current session (or select one) to a specified token limit. Works from within opencode when the session is still responsive, or as a standalone CLI that lists all sessions to choose from, then reopens opencode with the culled session. Works well enough for my use case. Reacted by gdw2vs and Youri Le Cottier drchopinfrederic commented on Feb 19, 2026 In my cases, I switch the model to GLM5-Free (or another model with a large context windows) and compact session multiple times. ( I did until it’s under 10K tokens.) I lost a detail of the context little bit, but at least I can recover the session from the deadlock, and can use the Anthropic opus model again.
Still, it need to be fix. it seems this happens when I switch to a model whose context window is smaller than the current session's token count. Trimming might sliced out the the middle of the session data, There should be a exception handling on the compacting sequence. zulufoxtrot commented on Mar 23, 2026 I'm having the same problem.
Model: Qwen3.5 122B A10B 6bit. Default context window.
Backend: oMLX
Frontend: Opencode GUI 1.2.26 (note: Opencode CLI not installed)
Tool calls / MCPs: default
I did not switch models / agents during the session. dlasher commented on May 20, 2026 Seeing this as well, doesn't seem to depend on the model, breaks a bit over 300k in size. github-actions commented on Jul 20, 2026 To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|