[GH-ISSUE #145] Stuck at max token limit #77

Closed
opened 2026-11-04 01:39:38 +07:00 by bsakaguchi · 13 comments
Owner

Originally created by @tdzard94 on GitHub (Sep 29, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/145

Image

I ran it with pi and always stuck at this error message. I tried stop and start again but can't fix

Originally created by @tdzard94 on GitHub (Sep 29, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/145 <img width="434" height="99" alt="Image" src="https://github.com/user-attachments/assets/6ed8c4b2-7f00-47a3-81f6-9f04f6db388a" /> I ran it with pi and always stuck at this error message. I tried stop and start again but can't fix
Author
Owner

@pdsmike commented on GitHub (Sep 29, 2026):

https://pi.dev/docs/latest/compaction
Pi's built-in auto-compaction settings are configured in ~/.pi/agent/settings.json or /.pi/settings.json
increase compaction.reserveTokens

<!-- gh-comment-id:5893005434 --> @pdsmike commented on GitHub (Sep 29, 2026): https://pi.dev/docs/latest/compaction Pi's built-in auto-compaction settings are configured in ~/.pi/agent/settings.json or <project-dir>/.pi/settings.json increase compaction.reserveTokens
Author
Owner

@tdzard94 commented on GitHub (Sep 29, 2026):

https://pi.dev/docs/latest/compaction Pi's built-in auto-compaction settings are configured in ~/.pi/agent/settings.json or /.pi/settings.json increase compaction.reserveTokens

thank for your help. I'll try it

<!-- gh-comment-id:5893525125 --> @tdzard94 commented on GitHub (Sep 29, 2026): > https://pi.dev/docs/latest/compaction Pi's built-in auto-compaction settings are configured in ~/.pi/agent/settings.json or /.pi/settings.json increase compaction.reserveTokens thank for your help. I'll try it
Author
Owner

@kelheor commented on GitHub (Sep 29, 2026):

I have similar problem with OpenCode CLI.
I saw:
[strata] thinking: 31910 of max 32000 tokens, 102.2 tok/s, 320 s
[strata] done: 32000 tokens in 321 s (102.2 tok/s) (length, cancel=False), expert cache 75.0% hit
and then it just stopped and I have to write "Continue"
Is there a way to increase max tokens for reasoning via some config? Also at some moment strata server stops writing output to OpenCode CLI, but continue to thinking - at least it looks like that.

<!-- gh-comment-id:5893836443 --> @kelheor commented on GitHub (Sep 29, 2026): I have similar problem with OpenCode CLI. I saw: [strata] thinking: 31910 of max 32000 tokens, 102.2 tok/s, 320 s [strata] done: 32000 tokens in 321 s (102.2 tok/s) (length, cancel=False), expert cache 75.0% hit and then it just stopped and I have to write "Continue" Is there a way to increase max tokens for reasoning via some config? Also at some moment strata server stops writing output to OpenCode CLI, but continue to thinking - at least it looks like that.
Author
Owner

@pdsmike commented on GitHub (Sep 29, 2026):

In any harness, when the LLM is in a long coding task and the context is already low it may hit the limit, that's why there is automatic compaction when certain criteria are met. Every harness has it's own settings. For OpenCode look here:
https://opencode.ai/v2/docs/compaction/

<!-- gh-comment-id:5894094460 --> @pdsmike commented on GitHub (Sep 29, 2026): In any harness, when the LLM is in a long coding task and the context is already low it may hit the limit, that's why there is automatic compaction when certain criteria are met. Every harness has it's own settings. For OpenCode look here: https://opencode.ai/v2/docs/compaction/
Author
Owner

@amonpaike commented on GitHub (Sep 29, 2026):

in PI models.json I added the entry I put like this, the context is the same that I gave to strata and I have no problems

"strata": {
      "baseUrl": "http://localhost:8080/v1",
      "api": "openai-completions",
      "apiKey": "lm-studio",
      "models": [
        {
          "id": "qwen3.8-flash-next-q2_0",
          "name": "qwen3.8-flash-next-q2_0",
          "contextWindow": 94208,
          "input": [
            "text",
            "image"
          ],
          "reasoning": true,
          "thinkingLevelMap": {
            "off": "off",
            "minimal": "minimal",
            "low": "low",
            "medium": "medium",
            "max": "max",
            "high": "high",
            "xhigh": "xhigh",
            "extreme": "extreme",
            "ultracode": "ultracode"
          }
<!-- gh-comment-id:5894239425 --> @amonpaike commented on GitHub (Sep 29, 2026): in PI models.json I added the entry I put like this, the context is the same that I gave to strata and I have no problems ``` "strata": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "lm-studio", "models": [ { "id": "qwen3.8-flash-next-q2_0", "name": "qwen3.8-flash-next-q2_0", "contextWindow": 94208, "input": [ "text", "image" ], "reasoning": true, "thinkingLevelMap": { "off": "off", "minimal": "minimal", "low": "low", "medium": "medium", "max": "max", "high": "high", "xhigh": "xhigh", "extreme": "extreme", "ultracode": "ultracode" } ```
Author
Owner

@dandandelion commented on GitHub (Sep 29, 2026):

Strata reserves some tokens after you allocate for example 131072, you need to configure your harness to use lower than that for example 128000. Usually in pi harness, they attach their max token output in their payload, and if your prompt + configured max token output exceeds the one in strata, strata will complain.

<!-- gh-comment-id:5894332552 --> @dandandelion commented on GitHub (Sep 29, 2026): Strata reserves some tokens after you allocate for example 131072, you need to configure your harness to use lower than that for example 128000. Usually in pi harness, they attach their max token output in their payload, and if your prompt + configured max token output exceeds the one in strata, strata will complain.
Author
Owner

@amonpaike commented on GitHub (Sep 29, 2026):

pi also has some buffering, so the actual real context is even smaller.
Image

<!-- gh-comment-id:5894491165 --> @amonpaike commented on GitHub (Sep 29, 2026): pi also has some buffering, so the actual real context is even smaller. <img width="2838" height="1856" alt="Image" src="https://github.com/user-attachments/assets/3e7d01b7-6d9a-450c-86db-a921bc050858" />
Author
Owner

@kelheor commented on GitHub (Sep 29, 2026):

In any harness, when the LLM is in a long coding task and the context is already low it may hit the limit, that's why there is automatic compaction when certain criteria are met. Every harness has it's own settings. For OpenCode look here: https://opencode.ai/v2/docs/compaction/

I have 262k context and when it happened, it was only filled by 30k. It's a problem of strata server, I think - it looks like it has hardcoded limit of max reasoning output.

<!-- gh-comment-id:5894558146 --> @kelheor commented on GitHub (Sep 29, 2026): > In any harness, when the LLM is in a long coding task and the context is already low it may hit the limit, that's why there is automatic compaction when certain criteria are met. Every harness has it's own settings. For OpenCode look here: https://opencode.ai/v2/docs/compaction/ I have 262k context and when it happened, it was only filled by 30k. It's a problem of strata server, I think - it looks like it has hardcoded limit of max reasoning output.
Author
Owner

@tdzard94 commented on GitHub (Sep 29, 2026):

In any harness, when the LLM is in a long coding task and the context is already low it may hit the limit, that's why there is automatic compaction when certain criteria are met. Every harness has it's own settings. For OpenCode look here: https://opencode.ai/v2/docs/compaction/

I have 262k context and when it happened, it was only filled by 30k. It's a problem of strata server, I think - it looks like it has hardcoded limit of max reasoning output.

I think this error come from strata. I try to run same pi setting with unsloth and it work very well

<!-- gh-comment-id:5894661508 --> @tdzard94 commented on GitHub (Sep 29, 2026): > > In any harness, when the LLM is in a long coding task and the context is already low it may hit the limit, that's why there is automatic compaction when certain criteria are met. Every harness has it's own settings. For OpenCode look here: https://opencode.ai/v2/docs/compaction/ > > I have 262k context and when it happened, it was only filled by 30k. It's a problem of strata server, I think - it looks like it has hardcoded limit of max reasoning output. I think this error come from strata. I try to run same pi setting with unsloth and it work very well
Author
Owner

@tdzard94 commented on GitHub (Sep 29, 2026):

Sometime I got this error
Error: 400: {"type":"invalid_request_error","message":"prompt (98473 tokens) + max tokens (32768) exceeds the context (131072); requests are never truncated"}

<!-- gh-comment-id:5894687149 --> @tdzard94 commented on GitHub (Sep 29, 2026): Sometime I got this error Error: 400: {"type":"invalid_request_error","message":"prompt (98473 tokens) + max tokens (32768) exceeds the context (131072); requests are never truncated"}
Author
Owner

@dandandelion commented on GitHub (Sep 29, 2026):

Sometime I got this error Error: 400: {"type":"invalid_request_error","message":"prompt (98473 tokens) + max tokens (32768) exceeds the context (131072); requests are never truncated"}

with my pi, I've never had this problem. (Attached SS even compacted 4 times before it finishes the full stack app)
Image

Image
<!-- gh-comment-id:5894738369 --> @dandandelion commented on GitHub (Sep 29, 2026): > Sometime I got this error Error: 400: {"type":"invalid_request_error","message":"prompt (98473 tokens) + max tokens (32768) exceeds the context (131072); requests are never truncated"} with my pi, I've never had this problem. (Attached SS even compacted 4 times before it finishes the full stack app) <img width="3840" height="1022" alt="Image" src="https://github.com/user-attachments/assets/29696e44-6df0-48ae-9daa-60d3862707cb" /> <img width="3840" height="1022" alt="Image" src="https://github.com/user-attachments/assets/18d7b695-642d-404b-bebc-23e6bcd4be0e" />
Author
Owner

@tdzard94 commented on GitHub (Sep 29, 2026):

Sometime I got this error Error: 400: {"type":"invalid_request_error","message":"prompt (98473 tokens) + max tokens (32768) exceeds the context (131072); requests are never truncated"}

with my pi, I've never had this problem. (Attached SS even compacted 4 times before it finishes the full stack app) Image

Image

Maybe I need add some more config for pi. I've been using pi for 1 month lately so I am using default config. Only added local model

<!-- gh-comment-id:5894910980 --> @tdzard94 commented on GitHub (Sep 29, 2026): > > Sometime I got this error Error: 400: {"type":"invalid_request_error","message":"prompt (98473 tokens) + max tokens (32768) exceeds the context (131072); requests are never truncated"} > > with my pi, I've never had this problem. (Attached SS even compacted 4 times before it finishes the full stack app) <img alt="Image" width="2000" height="532" src="https://private-user-images.githubusercontent.com/139849209/661426259-29696e44-6df0-48ae-9daa-60d3862707cb.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTA3MDE1ODUsIm5iZiI6MTc5MDcwMTI4NSwicGF0aCI6Ii8xMzk4NDkyMDkvNjYxNDI2MjU5LTI5Njk2ZTQ0LTZkZjAtNDhhZS05ZGFhLTYwZDM4NjI3MDdjYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwOTI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDkyOVQxNzAxMjVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yZWMyNGZlZGViOTE0NTY3Zjg4OWM5MjMwMjUyYWNlMjlmZjFmMjY1ZTU1NjA4ODEyM2IyNjllNzZlNThlYjQ2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZyZXNwb25zZS1jb250ZW50LXR5cGU9aW1hZ2UlMkZwbmcifQ.mZP1gP9YVRZuNakjkVvDXz6ZqwDDXieR1-23qiBSiJQ"> > > <img alt="Image" width="2000" height="532" src="https://private-user-images.githubusercontent.com/139849209/661427792-18d7b695-642d-404b-bebc-23e6bcd4be0e.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTA3MDE1ODUsIm5iZiI6MTc5MDcwMTI4NSwicGF0aCI6Ii8xMzk4NDkyMDkvNjYxNDI3NzkyLTE4ZDdiNjk1LTY0MmQtNDA0Yi1iZWJjLTIzZTZiY2Q0YmUwZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwOTI5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDkyOVQxNzAxMjVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iODg4ODFiZmMzNWY5NjAxYjBmMDQ0NWRlY2YwYjkzM2JjNDQ4OTQwNDMwMDEyNDUyMDk5NDA4MWMzYjhmNDk0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZyZXNwb25zZS1jb250ZW50LXR5cGU9aW1hZ2UlMkZwbmcifQ.IOkFRKcVHXQndveX3pgjyEZn2tbwsc8wVQq_iXSzG-I"> Maybe I need add some more config for pi. I've been using pi for 1 month lately so I am using default config. Only added local model
Author
Owner

@Niko1221 commented on GitHub (Sep 29, 2026):

Thanks, and thanks to everyone who helped here. The 32,000 limit is the max_tokens your client sends; Strata stops there with finish reason length. Raise the client's output limit, or set "fit_max_tokens": true in the run config so Strata shrinks the cap to fit the context instead of returning a 400. Please reopen if it still stops early after that.

<!-- gh-comment-id:5898171818 --> @Niko1221 commented on GitHub (Sep 29, 2026): Thanks, and thanks to everyone who helped here. The 32,000 limit is the `max_tokens` your client sends; Strata stops there with finish reason `length`. Raise the client's output limit, or set `"fit_max_tokens": true` in the run config so Strata shrinks the cap to fit the context instead of returning a 400. Please reopen if it still stops early after that.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#77
No description provided.