[BUG] Session resume fails with 503 when JSONL contains accumulated PDF/file attachments (Bedrock provider)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code persists every PDF/file attachment to the session JSONL in two places: as base64 in document/image content blocks, AND as base64 in toolUseResult.file.base64 cache entries. Both get included when the session is replayed on --resume, sending the cumulative bytes from every prior turn in a single request to the provider. On the Bedrock provider (CLAUDE_CODE_USE_BEDROCK=1) this routinely exceeds backend limits and the entire session becomes unresumable.
In my case a session of 309 lines with ~5 PDFs attached over its lifetime grew to 36.8 MB on disk. After stripping the base64 payloads (replacing with text placeholders), the same session was 0.61 MB and resumed instantly.
/compact is not a workaround: it runs as a request against the bloated history, so it fails with the same 503.
What Should Happen?
A session that successfully created or read N attachments should remain resumable regardless of N. Concretely, one or more of:
Don't persist full base64 in the JSONL; persist a reference (path/hash) and re-load on demand
Cap individual attachment size in JSONL; persist a reference for anything above the cap
Provide a built-in command (claude session prune <id> or similar) that strips attachment payloads while preserving conversation structure
Make /compact resilient to oversized history (e.g., truncate attachment payloads before sending its own request)
Any of these would prevent unrecoverable session loss from accumulated attachments.
Error Messages/Logs
In the broken session on resume, after the first prompt:
503 {"detail":{"error":"{\"message\":\"Bedrock is unable to process your request.\"}"}}
Retrying in 0s · attempt 1/10
... [identical retries through attempt 10/10]
The 0-second retry interval also seems wrong — it can prolong throttling on the upstream gateway.
Steps to Reproduce
- macOS 15.x, Claude Code 2.1.170 (SF-managed distribution)
- Provider: Bedrock via gateway
CLAUDE_CODE_USE_BEDROCK=1
ANTHROPIC_BEDROCK_BASE_URL=<gateway>/bedrock
- Model: us.anthropic.claude-opus-4-7[1m]
- In a fresh session, attach 4–5 PDFs of ~5–10 MB each via the Read tool over the course of normal conversation. Continue working with the assistant for ~30 turns.
- Exit Claude Code.
- Inspect the session JSONL at ~/.claude/projects/<project-hash>/<session-id>.jsonl — observe size in tens of MB.
- Resume the session: claude --resume <session-id>
- Send any prompt (e.g., "test").
Expected: prompt is processed normally.
Actual: request fails with the 503 above, retries 10x, session is unrecoverable.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.153 (Claude Code)
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
2.1.153 (Claude Code) is the latest version I get when I run claude --update in my organization
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗