GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — prompt is too long unrecoverable · Issue #4845 · anomalyco/opencode

prompt is too long unrecoverable #4845

New issue
Copy link
New issue
Copy link
Closed as not planned
#6480
Closed as not planned
prompt is too long unrecoverable#4845
#6480
Copy link
Assignees
rekram1-node

Description

@benceferdinandy-signifyd
benceferdinandy-signifyd
opened on Nov 27, 2025
Issue body actions

Description

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

Activity

Next
  1. benceferdinandy-signifyd
    added
    bugSomething isn't working
    on Nov 27, 2025
  2. github-actions
    added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 27, 2025
  3. github-actions commented on Nov 27, 2025

    @github-actions
    github-actionsBot
    on Nov 27, 2025 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • AI_APICallError: prompt is too long #1092: AI_APICallError: prompt is too long - Nearly identical error with Opus model causing unrecoverable session state
    • AI_APICallError: prompt is too long &  AI_APICallError: OAuth token has been revoked. Please obtain a new token. #164: AI_APICallError: prompt is too long & OAuth error - Exact same token overflow error (201082 > 200000) with Anthropic Opus
    • [v0.1.162] [Anthropic: Claude Sonnet 4]: AI_APICallError: input length and 'max_tokens' exceed context limit: 140740 + 64000 > 200000, decrease input length or 'max_tokens and try again #491: input length and 'max_tokens' exceed context limit - Same context window calculation issue with Anthropic models
    • AT_APICallError: prompt token count of 130389 exceeds the limit of 128000 #2464: AT_APICallError: prompt token count exceeds limit - Similar token overflow blocking work (130389 > 128000)
    • bufio.Scanner: token too long #3409: Opencode stuck after token too long - Token overflow causing stuck/unrecoverable state
    • Fetched documentation exeeds context window limit - Automatic truncation possible? #1212: Fetched documentation exceeds context window limit - Context window overflow from tool outputs
    • [Question] Is automatic tool calling output truncation supported? #4826: Is automatic tool calling output truncation supported? - Root cause discussion about tools generating huge outputs

    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!

  4. rekram1-node
    removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 2, 2025
  5. rekram1-node
    self-assigned this
    on Dec 2, 2025
  6. menoatree commented on Dec 12, 2025

    @menoatree
    menoatree
    on Dec 12, 2025
    More actions

    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
    
  7. Nindaleth commented on Dec 18, 2025

    @Nindaleth
    Nindaleth
    on Dec 18, 2025
    Contributor
    More actions

    @menoatree That URL returns over 450 kB of data for me, that must be around 100,000 tokens of context.

  8. ben-vargas commented on Dec 19, 2025

    @ben-vargas
    ben-vargas
    on Dec 19, 2025
    Contributor
    More actions

    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.

  9. thdxr commented on Dec 30, 2025

    @thdxr
    thdxr
    on Dec 30, 2025
    Member
    More actions

    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
  10. rekram1-node
    marked prompt is too long #5360 as a duplicate of this issue on Dec 31, 2025
  11. rekram1-node
    marked [BUG]: GPT 5.2 context_length_exceeded / Your input exceeds the context window of this model. #6071 as a duplicate of this issue on Dec 31, 2025
  12. rekram1-node
    marked [FEATURE]: Allow continuation after context overflow #5178 as a duplicate of this issue on Dec 31, 2025
  13. rekram1-node
    closed this as completedin #6480on Jan 1, 2026
  14. PeterHa-UoH commented on Jan 6, 2026

    @PeterHa-UoH
    PeterHa-UoH
    on Jan 6, 2026
    More actions

    will be fixing this next week

    has it been fixed yet/

    Reacted by Carlos Gratacos
  15. Nindaleth commented on Jan 6, 2026

    @Nindaleth
    Nindaleth
    on Jan 6, 2026
    Contributor
    More actions

    @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
  16. 12 remaining items

  17. miguelangelmorenochacon commented on Feb 10, 2026

    @miguelangelmorenochacon
    miguelangelmorenochacon
    on Feb 10, 2026
    More actions

    Happening with Opus 4.6

    Reacted by ff34wf, Ashay Changwani and Ryan Massive
  18. ashaychangwani commented on Feb 11, 2026

    @ashaychangwani
    ashaychangwani
    on Feb 11, 2026
    More actions

    Can we please reopen this issue? A lot of people are reporting the same in #5360

  19. rekram1-node
    reopened this on Feb 11, 2026
  20. rekram1-node commented on Feb 11, 2026

    @rekram1-node
    rekram1-node
    on Feb 11, 2026
    Member
    More actions

    I found some places we had issues, fixing

    Reacted by Julien Etienne, Boris Chumichev and Tekeste Gebreanenia
  21. daheli commented on Feb 13, 2026

    @daheli
    daheli
    on Feb 13, 2026
    More actions

    Same issue
    code-yeongyu/oh-my-openagent#1815

    Image
  22. smashah commented on Feb 14, 2026

    @smashah
    smashah
    on Feb 14, 2026
    More actions

    The whole payload seems to be filled with tool definitions

  23. ogyr commented on Feb 14, 2026

    @ogyr
    ogyr
    on Feb 14, 2026
    More actions

    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"

    Reacted by JBP
  24. iamtekeste commented on Feb 15, 2026

    @iamtekeste
    iamtekeste
    on Feb 15, 2026
    More actions

    Is there a workaround in the meantime?

  25. ogyr commented on Feb 15, 2026

    @ogyr
    ogyr
    on Feb 15, 2026
    More actions

    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
  26. drchopinfrederic commented on Feb 19, 2026

    @drchopinfrederic
    drchopinfrederic
    on Feb 19, 2026
    More actions

    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.

  27. zulufoxtrot commented on Mar 23, 2026

    @zulufoxtrot
    zulufoxtrot
    on Mar 23, 2026
    More actions

    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.

  28. thdxr
    removed
    bugSomething isn't working
    on May 3, 2026
  29. dlasher commented on May 20, 2026

    @dlasher
    dlasher
    on May 20, 2026
    More actions

    Seeing this as well, doesn't seem to depend on the model, breaks a bit over 300k in size.

  30. github-actions commented on Jul 20, 2026

    @github-actions
    github-actionsBot
    on Jul 20, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  31. github-actions
    closed this as not plannedon Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.