[BUG] Renderer shows "Unhandled case: [object Object]" instead of context-limit error message when API rejects an oversized request

Resolved 💬 1 comment Opened May 14, 2026 by danielw593-R1 Closed Jun 12, 2026

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?

Summary

When a conversation exceeds the API context limit, the API correctly returns invalid_request_error with a useful, user-actionable message (e.g., "This request exceeds Claude's context limit by about 565,935 tokens. Try removing some attachments, turning off some tools, or shortening your message."). The renderer fails to display this message and instead falls into a default branch showing literal text:

Unhandled case: [object Object] View output logs · Troubleshooting resources

This leaves the user with no actionable signal about what went wrong or how to recover.

Environment

  • Claude Desktop: 1.7196.0
  • macOS: 26.3.1 (build 25D2128)
  • Surface: main conversation pane (also visible in left-side "Review context and session setup" panel after a session restart)

Repro

  1. Build up a long conversation that includes large tool outputs (e.g., transcripts via the granola MCP) and/or paste-attached files (~300K+ tokens of attachments).
  2. Eventually total context approaches the 1M Opus window.
  3. Send the next message.
  4. API rejects with invalid_request_error.
  5. Renderer displays "Unhandled case: [object Object]" instead of the descriptive error message that came back in the response body.

Evidence (from ~/Library/Logs/Claude/claude.ai-web.log)

Two captured instances today, distinct conversation IDs:

2026-05-14 09:31:58 [error] [COMPLETION] Request failed {"type":"invalid_request_error","statusCode":0,"extra":{"details":{"error_visibility":"user_facing"}},"errorCode":null,"endpoint":"/api/.../completion","method":"POST","name":"Error","message":"This request exceeds Claude's context limit by about 565,935 tokens. Try removing some attachments, turning off some tools, or shortening your message."}

2026-05-14 09:32:32 [error] [COMPLETION] Request failed {"type":"invalid_request_error","statusCode":0,"extra":{"details":{"error_visibility":"user_facing"}},"errorCode":null,"endpoint":"/api/.../completion","method":"POST","name":"Error","message":"This request exceeds Claude's context limit by about 561,866 tokens (attachments ~311,000 tokens). Try removing some attachments, turning off some tools, or shortening your message."}

Both errors:

  • type: "invalid_request_error"
  • extra.details.error_visibility: "user_facing" — explicit signal that the message is intended for end-user display
  • .message contains a clear, actionable string the renderer should surface verbatim

Minified stack points to renderer code at:

  • Nu() in c2ee0272b-DDqQoSVR.js
  • onmessage() in index-DqD7M_o5.js

Expected

The user sees: "This request exceeds Claude's context limit by about ~566K tokens. Try removing some attachments, turning off some tools, or shortening your message."

Ideally with a CTA to start a new conversation or drop attachments from the current one.

Actual

The user sees: "Unhandled case: [object Object]"

Impact

Most affected users won't realize the issue is context-overflow — they'll attribute the error to "Claude Code is broken" or repeatedly retry the same message. Restart → re-send → same error. The actionable recovery (drop attachments / start fresh conversation) is invisible.

Suggested fix

In the error-rendering path, when an error carries extra.details.error_visibility === "user_facing", surface error.message directly. The current "Unhandled case" fallback should never be reached for explicitly user-facing errors.

Related

  • Common trigger pattern: MCP servers that return large tool results (e.g., granola meeting transcripts) inflate context faster than UI hints suggest.

What Should Happen?

Expected

The user sees: "This request exceeds Claude's context limit by about ~566K tokens. Try removing some attachments, turning off some tools, or shortening your message."

Ideally with a CTA to start a new conversation or drop attachments from the current one.

Actual

The user sees: "Unhandled case: [object Object]"

Error Messages/Logs

## Evidence (from `~/Library/Logs/Claude/claude.ai-web.log`)

Two captured instances today, distinct conversation IDs:

2026-05-14 09:31:58 [error] [COMPLETION] Request failed {"type":"invalid_request_error","statusCode":0,"extra":{"details":{"error_visibility":"user_facing"}},"errorCode":null,"endpoint":"/api/.../completion","method":"POST","name":"Error","message":"This request exceeds Claude's context limit by about 565,935 tokens. Try removing some attachments, turning off some tools, or shortening your message."}

2026-05-14 09:32:32 [error] [COMPLETION] Request failed {"type":"invalid_request_error","statusCode":0,"extra":{"details":{"error_visibility":"user_facing"}},"errorCode":null,"endpoint":"/api/.../completion","method":"POST","name":"Error","message":"This request exceeds Claude's context limit by about 561,866 tokens (attachments ~311,000 tokens). Try removing some attachments, turning off some tools, or shortening your message."}

Steps to Reproduce

2026-05-14 09:31:58 [error] [COMPLETION] Request failed {"type":"invalid_request_error","statusCode":0,"extra":{"details":{"error_visibility":"user_facing"}},"errorCode":null,"endpoint":"/api/.../completion","method":"POST","name":"Error","message":"This request exceeds Claude's context limit by about 565,935 tokens. Try removing some attachments, turning off some tools, or shortening your message."}

2026-05-14 09:32:32 [error] [COMPLETION] Request failed {"type":"invalid_request_error","statusCode":0,"extra":{"details":{"error_visibility":"user_facing"}},"errorCode":null,"endpoint":"/api/.../completion","method":"POST","name":"Error","message":"This request exceeds Claude's context limit by about 561,866 tokens (attachments ~311,000 tokens). Try removing some attachments, turning off some tools, or shortening your message."}

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

Claude Code 2.1.133

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗