ErrLookup › Background articles › payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads
payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads
"Payload too large", "request exceeds the maximum size", "exceeds max bytes" — errors from libraries that refuse to process a body, frame, or field because its size (in bytes or characters) crosses a deliberate cap. This article explains where these caps live, why they exist (memory guards, gzip/snappy bomb defenses, context-window and UI protection), and the general ways to fix them: shrink, chunk, reference instead of inline, or tune the limit on the right side.
Distilled from 97 documented records across 50 repositories.
Background
This family gathers errors raised when a producer-side size check fires before the payload is processed: a request body, a wire frame, a serialized field, or a decompressed blob exceeds a cap the library enforces. The checks share a shape — measure the payload (bytes via byteLength/bytesize/len, or characters via string length), compare against a constant or config value, and reject with a message that reports both actual and maximum sizes (e.g. Hadoop's "tried to deserialize {} bytes of data, but maxLength = {}", Navidrome's "payload size %d exceeds maximum of %d bytes"). The rejection happens early, often before any parsing, decompression, or allocation of the real payload.
The caps exist for several distinct reasons. One is memory-exhaustion defense: Hadoop's readString guards and RustFS's 1 MiB scanner-state bound exist so a corrupt or hostile length prefix cannot trigger a huge allocation and OOM. A closely related variant is decompression-bomb protection: LiveKit caps gzip-decompressed join requests at 1 MiB with a LimitReader, MLflow reads at most max_size+1 bytes of the zstd-expanded gateway body, and VictoriaMetrics refuses snappy blocks whose header declares a decoded length above maxDataSizeBytes. Another reason is protecting a downstream consumer's budget: OpenAI Codex caps queued text at 1,048,576 characters so one message cannot monopolize the model context window, ChromaCloud warns when a chunk exceeds the cloud provider's 16,384-character document quota, and Rocket.Chat charges every MCP tool response in a batch to a shared 5 MiB budget.
From the caller's side the error is deterministic and content-driven: the same payload fails the same way every time, and the message usually states both numbers so you can measure the distance to the cap. Whether it is recoverable varies. Some checks are warnings or graceful degradation (AnythingLLM's ChromaCloud oversize notice, AnotherRedisDesktopManager's read-only ViewerOverSize, Hmbown/CodeWhale's OSC 52 clipboard fallback refusal), some abort a batch or session (buzz-agent terminates the stdio reader loop, claude-mem's push stalls that sync lane until the offending row is removed), and some are plain HTTP 413/422-style rejections (Sure's {error: 'file_too_large'} on a 10 MB CSV upload).
The family also varies in what is measured and which side can tune it. Byte-based caps (Sure's bytesize check, Navidrome's 1 MB task payload, buzz-agent's BUZZ_AGENT_MAX_LINE_BYTES) hit multi-byte UTF-8 and base64 content sooner than character-based ones (Codex counts chars over Text items only). Some limits are frozen constants with no runtime knob (Sure's Import::MAX_CSV_SIZE, RustFS's 256 KiB redaction budget, mise's MAX_ACTION_PREDICTION_PAYLOAD), while others are configurable (Hadoop's ipc.maximum.response.length, MLFLOW_GATEWAY_MAX_DECOMPRESSED_REQUEST_SIZE, buzz-agent's env var). Units matter too: caps may apply per item (a single Chroma chunk), per frame (one SSE event under 8 MiB in CodeWhale), per request (LiveKit's join body), or cumulatively across a batch (Rocket.Chat's shared MCP budget).
Common causes
- Inlining large blobs into a field or frame meant for small data. Base64 images, file contents, page excerpts, or dumped tool output stuffed into a text field, JSON argument, or task payload blow past caps designed for small instructions. Codex's char cap, Navidrome's 1 MB queue payload, AnythingLLM's metadata quota, and SiYuan's 8 MiB tool-value cap all fire this way.
- Legitimately large collections sent in one request. A directory listing with millions of entries, a multi-year CSV export, or many tool responses batched together exceed per-request or per-batch budgets. Hadoop's RPC response cap, Sure's 10 MB CSV limit, and Rocket.Chat's shared 5 MiB MCP budget are examples.
- Under-sized chunks or frames from the producer pipeline. Splitting that was supposed to happen did not: a text splitter set with a huge chunk size, a writer bypassing the per-item cap (claude-mem's wrapCanonicalBody), or a server streaming a separator-less stream larger than the 8 MiB SSE frame budget in CodeWhale.
- Compression-bomb or hostile length declarations. A tiny compressed body that expands past the cap (LiveKit's gzip limit, MLflow's zstd cap), a snappy header declaring an absurd decoded size (VictoriaMetrics), or a corrupt/hostile length VInt in Hadoop's serialization all trigger defensive rejections.
- Writer and reader limits tuned inconsistently. A constant lowered or raised on one side but not the other — a cap changed without re-checking per-item sizes (claude-mem), a limit raised on the writer but not the reader (Hadoop's Text.readFields), or a metadata format whose growth eventually crosses a frozen budget (RustFS scanner state).
- Byte-vs-character and encoding inflation. Caps measured in bytes (Buffer.byteLength, bytesize, UTF-8 length) are reached sooner with multi-byte text and base64's ~1.37x inflation; character-counted caps (Codex, AnythingLLM) behave differently for the same content. Limits tuned in characters but enforced in bytes fail on multi-byte content (Hadoop's Text.write).
What usually fixes it
- [object Object]
- [object Object]
- [object Object]
- [object Object]
Go deeper
- HTTP status errors: handling 4xx and 5xx responses — how to handle 4xx and 5xx responses properly.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Documented occurrences
- sync hub push invariant: request exceeds ${MAX_BODY_BYTES} encoded bytes (thedotmack/claude-mem)
- file_too_large: File is too large. Maximum size is #{Import.max_csv_size / 1.megabyte}MB. (we-promise/sure)
- io: line exceeds max ({max} bytes) (block/buzz)
- queued user input exceeds the maximum length of {MAX_USER_INPUT_TEXT_CHARS} characters ({actual_chars} provided) (openai/codex)
- ChromaCloud::Document length too large (default max is ${this.limits.maxDocumentBytes}). Got ${testSubmission.document.length}. Upsert may fail! (Mintplex-Labs/anything-llm)
- action prediction payload is too large (jdx/mise)
- scanner cycle state exceeds the bounded object size (rustfs/rustfs)
- RPC response has a length of %d exceeds maximum data length (apache/hadoop)
- Redaction refused the document: its size in bytes exceeds the frozen budget of 262144. (rustfs/rustfs)
- prepared image exceeds size limit: %d bytes (siyuan-note/siyuan)
- content_too_large: Content is too large. Maximum size is #{Import.max_csv_size / 1.megabyte}MB. (we-promise/sure)
- decompressed data too large (livekit/livekit)
- Size too large, show only the first ${this.firstChars} characters and you cannot edit it. (qishibo/AnotherRedisDesktopManager)
- String length ${length} exceeds the limit of ${maxLength} (apache/hadoop)
- encrypted asset metadata is too large (siyuan-note/siyuan)
- MCP SSE frame exceeded {} bytes without a separator — aborting (Hmbown/CodeWhale)
- `create_bytes_source`: `Bytes` has length {}, which is greater than `u32::MAX` {} (clockworklabs/SpacetimeDB)
- MCP batch response exceeds the ${formattedLimit} limit (RocketChat/Rocket.Chat)
- message-length-exceeds-character-limit (RocketChat/Rocket.Chat)
- ChromaCloud::Metadata length too large (default max is ${this.limits.maxMetadataBytes}). Got ${JSON.stringify(testSubmission.metadata).length}. Upsert may fail! (Mintplex-Labs/anything-llm)
…and 77 more across the corpus — use search.
Honest provenance: generated on 2026-09-03 from AI-assisted analysis of the linked records. See how records are made.