anthropics / anthropics/claude-code

[BUG] "Request too large (max 32MB)" fires on first prompt with zero attachments when using a custom ANTHROPIC_BASE_URL

Open
#95,654 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:core area:providers bug platform:windows
Dominant language
TypeScript
Stars
147k
Forks
24k
PR merge metrics
PR metrics pending

Description

Preflight Checklist
  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code
What's Wrong?

Claude Code fails with the error "Request too large (max 32MB). Accumulated images and attachments in the conversation pushed the request over the limit. Run /compact, or double press esc to go back and remove attachments." This fires on the very first prompt of a brand-new session, in a directory that has never been used before, with zero images or attachments ever added to the conversation.

I use a custom ANTHROPIC_BASE_URL pointed at a self-hosted OpenAI/Anthropic-compatible gateway (OmniRoute, running locally in Docker) that routes requests to free-tier backends (Groq, Google AI Studio/Gemini). The error occurs regardless of which backend model is selected.

I have ruled out every locally-controllable cause:

  • Rewind (double-Esc) on the failing session shows exactly one entry (the prompt just typed) and (current) — zero prior history, zero attachments.
  • /compact reports "Not enough messages to compact" in the same failing session.
  • Full recursive size scan of %USERPROFILE%.claude, %LOCALAPPDATA%\claude-cli-nodejs, %LOCALAPPDATA%\Claude-Data, %LOCALAPPDATA%\Claude-3p, and %LOCALAPPDATA%\Claude\Logs shows nothing anywhere near 32MB of real conversation data (the only large files found were the desktop app's own debug logs, unrelated to any conversation).
  • The gateway's own request logs show zero trace of the failing request ever arriving — no entry at all for that timestamp. This proves the 32MB check fires client-side, before Claude Code even attempts the network call.
  • Reproduces identically after a full Claude Desktop restart, in multiple fresh working directories, and across different model/provider combinations behind the gateway.
  • Already on the latest Claude Code version (confirmed via npm).
What Should Happen?

Either the request should be sent normally when there's truly no oversized content, or — if something server-side genuinely is large — the error message should reflect the real cause instead of the generic "images and attachments" message, and it should not fire before a single real user turn exists in the conversation.

This appears to be a more severe/different variant of #83898: that issue describes attachment pruning being disabled under a custom ANTHROPIC_BASE_URL, causing gradual overflow in long sessions with real pasted images. This report is about the same error firing instantly on message #1 with zero attachments and zero history (confirmed via Rewind), which #83898's described mechanism doesn't explain.

Error Messages/Logs
Request too large (max 32MB). Accumulated images and attachments in the conversation pushed the request over the limit. Run /compact, or double press esc to go back and remove attachments.
Steps to Reproduce
  1. Set ANTHROPIC_BASE_URL to a custom Anthropic-Messages-compatible gateway (e.g. a self-hosted proxy such as OmniRoute routing to free-tier backends like Groq or Google AI Studio/Gemini) and set ANTHROPIC_AUTH_TOKEN accordingly.
  2. Open a brand-new terminal and cd into a directory that has never had a Claude Code session in it before (tested with an empty D:\Temp).
  3. Run claude.
  4. Type any plain-text prompt with no attachments, e.g. lets make a video.
  5. The "Request too large (max 32MB)" error fires immediately, within about 1 second, with no visible network round-trip.
  6. Press double-Esc to open Rewind: it shows only the single prompt just typed and (current) — confirming there is no accumulated history or attachments.
  7. Run /compact: it reports "Not enough messages to compact".
Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.278 (Claude Code)

Platform

Other

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information
  • Gateway used: OmniRoute v3.8.50 (self-hosted, Docker), acting as an Anthropic-Messages-compatible proxy in front of Groq and Google AI Studio (Gemini) free-tier models via a priority-fallback "combo".
  • claude doctor confirms several features are disabled under custom ANTHROPIC_BASE_URL: "Managed settings (remote): not fetched", "Organization policy: not fetched", "Remote Control: not available" — otherwise reports "No installation issues found."
  • Raising the gateway's own inbound request body limit from 10MB to 100MB had zero effect on this error, and the gateway's request logs show no entry at all for the failing request's timestamp — confirming the 32MB check happens entirely client-side, before any HTTP request is dispatched.
  • Related: https://github.com/anthropics/claude-code/issues/83898 (see note in "What Should Happen?" above on how this report differs).
  • Happy to provide the full claude doctor output or a minimal repro environment if useful.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with a fresh session, zero attachments, and a custom ANTHROPIC_BASE_URL, then inspect the client-side 32MB validation before the gateway request is dispatched. Compare the behavior across the reported model/provider combinations and confirm that a first plain-text prompt is sent normally without triggering the oversized-content error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.