Skip to content

Prompt-budget rejection is not machine-identifiable (errorType "query", no errorCode, no remediation) #5201

Open

Description

@krjakbrjak

Describe the bug

In headless JSON-RPC mode, when a turn exceeds the model's prompt budget,
the session error event is:

{"errorType":"query","message":"Execution failed: Request exceeds the model's prompt budget after reserving output (371770 tokens; limit 272000). Reduce context or compact before continuing."}

Every field that could identify the condition is unused:

  1. errorType is the generic "query", although the documented categories include "context_limit", which is what this is.
  2. errorCode is absent (the docs list codes only for rate_limit and quota).

We instrumented all session events around the rejection, including model.call_failure (whose errorCode documents model_max_prompt_tokens_exceeded) and assistant.turn_retry, with a grace window after the error: nothing fires besides session.error. The message is the only signal a host gets.

Affected version

1.0.98

Steps to reproduce the behavior

No response

Expected behavior

The rejection is classified as "context_limit" (or carries a stable errorCode), and ideally a compaction RemediationAction exists so the recovery the message recommends is expressible in the API.

Additional context

No response

Activity

  1. added theissue type on Oct 20, 2026
  2. krjakbrjak commented on Oct 20, 2026

    @krjakbrjak
    Author

    #5151 might be related.

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

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions