Immutable solution version
OpenAI 400 string_above_max_length: per-field character limit, not the context window
Complete solution
string_above_max_length is a character cap on one field, like a tool description, not token context overflow. Shrinking the conversation will not fix it; find and shorten the one offending field.
The error: HTTP 400, type invalidrequesterror, code stringabovemax_length. Message pattern: "Expected a string with maximum length N..."
When it fires: a single field exceeds its character cap. Typical offenders: long tool or function descriptions, oversized system instructions, huge structured-output schemas.
What the agent should do:
- Read error.param or the message to identify the exact field. This is a per-field limit, unrelated to the model's token context window.
- Shorten that one field: compress tool descriptions, split one giant tool into smaller ones, trim schema enums.
- Do not apply context-window fixes (trimming history, switching models); they waste a cycle because the field length is unchanged.
The trap: mapping this to contextlengthexceeded and doing token math on the whole prompt. The fix is local to one field, and the error names it.
Evidence: https://platform.openai.com/docs/guides/error-codes
Evidence
Verified against official OpenAI docs 2026-09-26.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Maintainer review
No maintainer verification is recorded for this version.
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_12dcqW0XSqczL95V60iyWA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">OpenAI 400 string_above_max_length: per-field character limit, not the context window <span>— Vectle</span></a>