You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've asked Claude (opencode v0.3.17, claude-opus-4-20250514) to do some research on the web, and it returned AI_APICallError: prompt is too long error. I can't continue the session. I wasn't able to compact it either.
After creating this issue, I went back to opencode and just typed something in to see if it's responsive because I got an error after typing /compact. And it gave me this.
@thdxr
Would not like to create another similar issue, so posting here.
opencode v0.3.132
The same error: "AI_APICallError: prompt is too long: 210171 tokens > 200000 maximum"
What I mentioned, though is the amount of used tokens in the top right corner
Does this shed some light on the issue? I keep getting this error a couple of times a day and every time at about 20% of context used ( if that's what the top info means)
Same here. Asked it to loop through a CSV and download a bunch of files, not a complicated ask and the total files are just ~30 PDFs, so surprised it hit a context limit basically right away.
I'm encountering this error during MCP server use. There doesn't appear to be guardrails on making sure that MCP server queries are properly limited or paged.
If the underlying MCP server allows the bot to do unrestricted queries for information, the bot can self-sabotage if it attempts to consume the unlimited MCP server output.
Also seeing this by just asking an agent to use the playwright MCP to do a web scrape. Haven't found a good workaround yet, some MCP server allow setting a token limit.
Activity
almirsarajcic commentedon Jul 17, 2025
After creating this issue, I went back to opencode and just typed something in to see if it's responsive because I got an error after typing

/compact. And it gave me this.neocoder commentedon Aug 6, 2025
@thdxr
Would not like to create another similar issue, so posting here.
opencode v0.3.132
The same error: "AI_APICallError: prompt is too long: 210171 tokens > 200000 maximum"
What I mentioned, though is the amount of used tokens in the top right corner
Does this shed some light on the issue? I keep getting this error a couple of times a day and every time at about 20% of context used ( if that's what the top info means)
taxilian commentedon Aug 8, 2025
This keeps happening to me as well; it seems to happen most often when it's looking at the output from a command, e.g. after running unit tests.
kevcube commentedon Aug 10, 2025
this is often happening to me too.
NotASithLord commentedon Aug 23, 2025
Same here. Asked it to loop through a CSV and download a bunch of files, not a complicated ask and the total files are just ~30 PDFs, so surprised it hit a context limit basically right away.
NotASithLord commentedon Aug 23, 2025
In my case it's being triggered whenever I try to download even a single PDF.
blentz commentedon Sep 2, 2025
I'm encountering this error during MCP server use. There doesn't appear to be guardrails on making sure that MCP server queries are properly limited or paged.
If the underlying MCP server allows the bot to do unrestricted queries for information, the bot can self-sabotage if it attempts to consume the unlimited MCP server output.
andreimarinescu commentedon Sep 8, 2025
Also seeing this by just asking an agent to use the playwright MCP to do a web scrape. Haven't found a good workaround yet, some MCP server allow setting a token limit.
rekram1-node commentedon Dec 28, 2025
[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!