Ollama Cloud 400 "failed to read request body"

By MV2 of Munim, Inc., with AI agents. Written on 13 November 2026 from Ollama v0.40.16's source (server/cloud_proxy.go, server/routes.go), Ollama's API docs, and the public reports linked below. We did not send requests to Ollama Cloud ourselves: the measurements are other people's, credited where they appear. See the limits.

A chat request to an Ollama Cloud model works for a while, then a long conversation (usually one with screenshots or pasted images) starts failing with:

400: failed to read request body

It often arrives after 10 to 15 seconds, and nothing in it says "too large". Agent apps then report something vaguer still, for example Codex Desktop's stream disconnected before completion: stream closed before response.completed, or a model that suddenly says it has no tools.

The short answer

Your situationMost likely causeFix
The conversation carries images (screenshots, tool outputs with images, pasted PNGs), and the error started as it grewThe whole JSON body has crossed about 32 MiB. Images are sent as base64, which is a third bigger than the files themselves, and most apps re-send every earlier image on every turn.Send fewer and smaller images: re-encode and cap them. Splitting images across messages does not help; the limit is on the whole request.
The request is small (a few MB or less), and it uses toolsThe JSON doesn't fit Ollama's request types, most often a tool schema with "enum": "x" (a string) where JSON Schema needs "enum": ["x"]Find and fix the schema. A small replay usually shows the real decode error.
You go through a local Ollama (model:cloud) and your client compresses requests with zstdThe local server caps a zstd body at 20 MiB once decompressed, before it reaches the cloud. That error reads http: request body too large, not "failed to read".Send the request uncompressed, or keep it under 20 MiB (details).

Where the 32 MiB comes from

Ollama doesn't document a size limit for /api/chat. Its error list names only 400, 404, 429, 500 and 502. Two separate reports measured where cloud chat requests start failing:

ReportPassed (HTTP 200)Failed with failed to read request body
ollama#19597 (7 Nov 2026, deepseek-v4.1-flash, 4.8 MB PNGs as base64 in one user message)1.77 MB text only (~373k prompt tokens); 25.6 MB (4 images); 31.14 MiB32.48 MiB; 38.0 MiB (6 images); 51.0 MiB (8 images)
OmniRoute#18684 (31 Oct 2026, Codex Desktop through a proxy to Ollama Cloud)9 images / 26.8 MB11 images / 32.7 MB; 13 images / 38.7 MB; 11 images in separate messages / 34.3 MB; a full 51.2 MB history

Both point at a cut-off just above 31 MiB and below 32.5 MiB, which fits 32 MiB (33,554,432 bytes) if OmniRoute's "MB" are MiB; that report doesn't say which. 32 MiB is also the documented request limit of Ollama's System One endpoint, where the local server enforces it in code (http.MaxBytesReader(..., 32<<20) in routes.go) and answers with a clear 413 request body must not exceed 32 MiB. The same docs give cloud System One requests a lower 13 MiB limit. Whether cloud chat applies 32 MiB, 13 MiB in some cases, or counts bytes before or after decoding, is exactly what #19597 asks; an Ollama collaborator replied there that the Ollama Cloud source isn't public, and there was no answer on the limit itself as of 13 November 2026.

The arithmetic is unkind to images. Base64 turns every 3 bytes into 4, so a 4.8 MB screenshot costs 6.4 MB of request, and five of them already sit at the edge. In OmniRoute's case the app re-sent every image from earlier tool outputs on every turn: 43 images in a 369-item history. Capping them cut the images from 36.3 MB to 2.4 MB, and the same session returned 200 and used its tools again.

Measure your request

If your app can log or save the request body (or you can rebuild it), measure it before guessing:

# size of a saved request body in MiB
python3 -c "import sys,os; print(round(os.path.getsize(sys.argv[1])/2**20, 2), 'MiB')" request.json

# how much of it is images (base64 strings longer than 10,000 characters)
python3 - request.json <<'EOF'
import json, sys
body = json.load(open(sys.argv[1]))
big = []
def walk(x):
    if isinstance(x, dict): [walk(v) for v in x.values()]
    elif isinstance(x, list): [walk(v) for v in x]
    elif isinstance(x, str) and len(x) > 10000: big.append(len(x))
walk(body)
print(len(big), "large strings,", round(sum(big)/2**20, 2), "MiB")
EOF

Over 30 MiB: treat it as the size limit. Well under it: look at the schema next.

Fix: send fewer, smaller images

Same message, different cause: a tool schema Ollama can't decode

Ollama decodes tool definitions into fixed Go types, so JSON that is valid but has the wrong shape is rejected before the model runs. In OmniRoute#18679 a tool parameter had "enum": "[MaxDepth]" (a string). A 490-byte replay to Ollama Cloud returned the explicit error:

json: cannot unmarshal string into Go struct field ToolProperty.enum of type []interface {} (ref: …)

The same request with "enum": ["[MaxDepth]"] returned 200. In the real Codex Desktop session (236 messages, 32 tools) the reporter saw only the generic failed to read request body; fixing the three bad enum values made that session work. The report doesn't explain why the long session got the generic message and the small replay the explicit one. Either way, a tool-schema problem can look like a size problem, and the model then claims it has no tools.

To check a saved request for the shapes that break decoding:

# every "enum" should be an array; prints any that are not
jq -c '[.. | objects | select(has("enum")) | select(.enum|type != "array") | .enum]' request.json

# same idea for "required", which must be an array of strings
jq -c '[.. | objects | select(has("required")) | select(.required|type != "array") | .required]' request.json

Empty arrays ([]) mean nothing was found. A tool parameter that is itself named enum or required shows up as a false alarm; ignore those. The usual source is an MCP server or app whose tool schema writes enum or required as a string; fix it there, or have your proxy drop or wrap such values.

If you go through a local Ollama (model:cloud)

When you ask a local Ollama for a model whose name ends in :cloud (for example gpt-oss:20b:cloud), the local server forwards the request to https://ollama.com. From cloudPassthroughMiddleware and proxyCloudRequestWithPath in v0.40.16:

Slow uploads

One more report fits the pattern: the same error after a very large request had been uploading for 108 seconds (magpie#3348, in Chinese). Whether the cloud also gives up on slow uploads, or that request was simply over the size limit, isn't known. If your uplink is slow, a smaller body helps here too.

If none of this fits

Ollama Cloud prints a ref: ID with some errors. If you report the problem on ollama#19597 or to Ollama, include the request size in bytes, the number and format of images, the model, whether you went direct or through a local Ollama, and those ref IDs. Don't post the request itself if it contains private data.

How this was made, and its limits

AI agents working for MV2 of Munim, Inc. read, on 13 November 2026: Ollama v0.40.16's server/cloud_proxy.go, server/routes.go and server/model_resolver.go; docs.ollama.com/api/errors and the System One docs; and the issues linked above. Limits:

Corrections are welcome as issues at github.com/munimtechnologies/local-ai-checkup.

Related

Check the rest of your setup

The free local-ai-checkup script shows which AI ports on your machine other computers can reach. The CVE checker tells you which security advisories affect your Open WebUI or Ollama version. Both are read-only and send nothing off the machine.

Want someone to check it for you?

MV2 of Munim, Inc. does a $49 local AI health check for one machine, or a $199 small-office check for up to 5 machines or one shared Ollama, vLLM or Open WebUI server. You get a written report of what's exposed, risky or slow and what to fix first, with exact commands for your OS. See a sample report. Pay $49 or pay $199 on Stripe, then email mv2@munimtech.com the output of python3 local_ai_checkup.py --json, your OS, and what you use it for. MV2 never asks for passwords, keys or remote access.