API 500 Error Loop After Cumulative Context Exceeds Threshold

Resolved 💬 7 comments Opened Dec 22, 2025 by Niels-LNS-Research Closed Feb 14, 2026

Claude Code Version: 2.0.75
Model: Opus 4.5
Platform: Windows
Date: 2025-12-22

Description

After a session accumulates substantial context (multiple file searches, document extraction, then PDF + markdown read), the API returns a 500 Internal Server Error with request_id: null. The session becomes permanently stuck - every subsequent message returns the same error until a new session is started.

Steps to Reproduce

  1. Start a session with project context loaded (CLAUDE.md + multiple rule files)
  2. Execute multiple file search operations (3 searches returning 20+ results each)
  3. Extract text from a Word document (~125 lines output)
  4. Read a PDF file (~245KB file size, unknown extracted content size)
  5. Read a small markdown file (~15 lines) in the same request
  6. Result: API returns 500 error, session becomes unrecoverable

Error Details

{
  "type": "error",
  "error": {
    "type": "api_error",
    "message": "Internal server error"
  },
  "request_id": null
}

Key Observations

  1. All tool operations succeeded - The PDF and markdown were read successfully; error occurred during API response generation
  2. request_id: null - Error occurs before request is fully logged, suggesting server-side context processing failure
  3. Not a file size issue - 245KB PDF is small; the issue appears to be cumulative context size
  4. Permanent error loop - Every subsequent API call fails with identical error; Esc/retry do not help
  5. No graceful degradation - Instead of context limit error, returns generic 500

Expected Behavior

  • API should handle context limits gracefully with informative error messages
  • Session should remain usable after an error
  • Should not enter unrecoverable error loop

No Known Workaround

Starting a new session escapes the error loop but does not prevent recurrence. The conditions that trigger this error are unclear.

Environment

  • Claude Code 2.0.75
  • Windows 11
  • Model: Opus 4.5
  • MCP servers: playwright, claude-in-chrome active
  • Project memory: CLAUDE.md + 9 rule files loaded

Session ID

62ced187-15a6-4454-afd6-a89701241154

View original on GitHub ↗

This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗