Logo SVG copied to clipboard
Early Access Build agents that never fail Learn more
OpenAI HTTP 400 Bad request

OpenAI 400 — Context length exceeded

34teams hit this · 30d
210occurrences · 30d
88%auto-recovered by Manifest
Occurrences across all Manifest teams, last 14 days

What this error means

A 400 context_length_exceeded fires when input tokens plus max_tokens exceed the model's context window.

How to fix it

  • Trim or summarize history before sending
  • Lower max_tokens to leave room for the prompt
  • Move to a longer-context model for big inputs
Example error message
{
  "error": {
    "message": "This model's maximum context length is 128000 tokens.",
    "type": "invalid_request_error",
    "code": "context_length_exceeded"
  }
}

Frequently asked

Does max_tokens count toward the limit?

Yes. The window must fit prompt tokens plus the completion you reserve with max_tokens.

Don't let your requests fail again and again

Manifest fixes your bad LLM requests on the fly so they return successful responses before it reaches your agent. No downtime.

  • Deprecated / Not-found models
  • Wrong parameters
  • Malformed requests
  • Exceeded context windows

Join the waitlist to get early access with a free month.