Skip to content

Error: 400: {"type":"invalid_request_error","message":"prompt (38963 tokens) + max tokens (226281) exceeds the context (262144); requests are never truncated"} #545

Closed

Description

@avarakin

Getting stuck with this error even after compacting. Increasing context does not help. I am using Pi.dev 1.0 harness. This issue does not happen with qwen 3.8 27b. Machine has 16g VRAM and 64g RAM.

Activity

  1. Niko1221 commented on Oct 3, 2026

    @Niko1221
    Owner

    Thanks. Pi asked for 226,281 output tokens on a 38,963-token prompt. Together that is about 3K over the 262,144-token context, and the server refuses such a request instead of cutting anything. Pi bases the output size on its context setting, so a larger context doesn't help. Two ways around it:

    • add "fit_max_tokens": true to the model's strata-<model>.json in the Strata folder and restart. The server then shortens max_tokens to the room that's left;
    • or give the model a smaller max output in Pi's model settings (e.g. 32768).

    From 0.1.38 the error message itself says this and gives the largest max_tokens that fits.

  2. avarakin commented on Oct 3, 2026

    @avarakin
    ContributorAuthor

    I added the parameter but still not able to open problematic session. I am able to open it with another qwen model and llama.cpp

  3. avarakin commented on Oct 3, 2026

    @avarakin
    ContributorAuthor

    one more thing: looks like it happens after compaction. I manually requested pi to compact, compact was successful, but after that i started getting this error and was not able to re-open session

  4. avarakin commented on Oct 3, 2026

    @avarakin
    ContributorAuthor

    Never mind, it worked. I applied the change incorrectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions