invalid_request_error: Invalid 'input[15].arguments': string too long

Open 💬 11 comments Opened Mar 2, 2026 by Gusarich
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.
ERROR: {
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "[StringParam] [input[15].arguments] [string_above_max_length] Invalid 'input[15].arguments': string too long. Expected a string with maximum length 1048576, but got a string with length 1524940 instead."
  },
  "status": 400
}

thread id: 019cafcd-90a8-7d31-8c01-007fe4a00a8a

happened with gpt-5.3-codex-spark, codex-cli 0.107.0-alpha.3, using exec

View original on GitHub ↗

11 Comments

github-actions[bot] contributor · 4 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #10506

Powered by Codex Action

tiagoefreitas · 4 months ago

have the same issue with latest 0.107.0 cli mode (not exec), I see "Invalid 'input[119].arguments': string too long. Expected a string with maximum length 1048576, but got a string with length
2261315 instead.

happened with spark but changing models doesnt fix the session

mzc2113391 · 4 months ago

{ "error": { "message": "Invalid 'input[531].arguments': string too long. Expected a string with maximum length 1048576, but got a string with length 1508785 instead.", "type": "invalid_request_error", "param": "input[531].arguments", "code": "string_above_max_length" } }

Benjamin-Dobell · 2 months ago
{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "[StringParam] [input[85].arguments] [string_above_max_length] Invalid 'input[85].arguments': string too long. Expected a string with maximum length 1048576, but
got a string with length 1420421 instead."
  },
  "status": 400
}

Codex Spark. But swapping back to another model with the existing session doesn't resolve the problem.

> codex --version
codex-cli 0.129.0
freQuensy23-coder · 2 months ago

same issue for me

LoGic142 · 1 month ago

Any updates on this?

genglinWang · 21 days ago

Definitely the same issue. Any solution?

Hexman768 · 21 days ago

I am also seeing this issue, tried changing the reasoning level since changing the model doesn't seem to work either but the issue is still present.

JW-Rami · 5 days ago

Additional reproduction from Codex Desktop on macOS:

After the UI displayed “Context automatically compacted”, the session failed with:

[StringParam] [input[413].arguments] [string_above_max_length]
Invalid 'input[413].arguments': string too long.
Expected a string with maximum length 1048576, but got a string with length 1279780 instead.

This occurred in the same thread after automatic context compaction. The error prevents the turn from continuing.

JW-Rami · 5 days ago
After the UI displayed “Context automatically compacted”, the session failed with:

Already restarted my app nothing change and im up to date with the latest version:
Version 26.707.72221

JW-Rami · 5 days ago

Proposed fix (not submitted as a PR because external code contributions are invitation-only; see contributing guidelines).

This report is a concrete input[*].arguments reproduction of the older oversized replay payload family reported in #10506, while #13270 captures the function-call-arguments variant.

Patch outline

At the request-history formatting boundary in codex-rs/core/src/client_common.rs:

  1. Identify completed FunctionCall items whose arguments string is above a conservative 1,000,000-character limit.
  2. Replace only those replayed arguments with a small valid JSON placeholder.
  3. Preserve the call_id and matching FunctionCallOutput.
  4. Leave unfinished calls and the original in-memory history unchanged.
  5. Add a regression test covering the automatic-compaction failure.

The proposed patch is implemented and locally validated on branch agent/oversized-tool-arguments-pr, commit 9a00d3c00c.

Validation:

  • cargo test -p codex-core client_common::tests: 7 passed
  • git diff --check: passed
  • Clippy reaches the changed code but is blocked by the pre-existing clippy::large_enum_variant error in core-plugins/src/manifest.rs.

This avoids blindly truncating active tool calls and prevents a completed historical call from making the next Responses API request invalid.