claude-code - 💡(How to fix) Fix [BUG] VS Code extension renders tool_reference content blocks as "Unhandled case: [object Object]"

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The Claude Code VS Code extension (v2.1.141) cannot render content blocks of type: "tool_reference" in the conversation history. The message renderer falls through to its default branch and outputs the literal string Unhandled case: [object Object] followed by a generic "View output logs · Troubleshooting resources" error footer.

Error Message

The Claude Code VS Code extension (v2.1.141) cannot render content blocks of type: "tool_reference" in the conversation history. The message renderer falls through to its default branch and outputs the literal string Unhandled case: [object Object] followed by a generic "View output logs · Troubleshooting resources" error footer. 3. Scroll the conversation. The message containing the ToolSearch tool_result renders as a red error widget instead of normal content. Red error widget showing: Looks like a fatal error to users, but is purely a renderer fallthrough. The Claude Code VS Code extension (v2.1.141) cannot render content blocks of type: "tool_reference" in the conversation history. The message renderer falls through to its default branch and outputs the literal string Unhandled case: [object Object] followed by a generic "View output logs · Troubleshooting resources" error footer. 3. Scroll the conversation. The message containing the ToolSearch tool_result renders as a red error widget instead of normal content. Red error widget showing: Looks like a fatal error to users, but is purely a renderer fallthrough.

Error Messages/Logs

  1. Scroll the conversation. The message containing the ToolSearch tool_result renders as a red error widget instead of normal content.

Root Cause

The Claude Code VS Code extension (v2.1.141) cannot render content blocks of type: "tool_reference" in the conversation history. The message renderer falls through to its default branch and outputs the literal string Unhandled case: [object Object] followed by a generic "View output logs · Troubleshooting resources" error footer.

Code Example

{ "type": "tool_reference", "tool_name": "EnterPlanMode" }

---

{ "type": "tool_reference", "tool_name": "EnterPlanMode" }

---
RAW_BUFFERClick to expand / collapse

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?

Summary

The Claude Code VS Code extension (v2.1.141) cannot render content blocks of type: "tool_reference" in the conversation history. The message renderer falls through to its default branch and outputs the literal string Unhandled case: [object Object] followed by a generic "View output logs · Troubleshooting resources" error footer.

Where the malformed-looking blocks come from

tool_reference blocks are returned by the ToolSearch tool whenever it loads a deferred tool's JSONSchema definition. Each block has just two keys:

{ "type": "tool_reference", "tool_name": "EnterPlanMode" }

They're wrapped inside a tool_result and live in the persisted session JSONL.

Why this is high-volume

Plan-mode (EnterPlanMode / ExitPlanMode) is a deferred tool. Any environment that defaults new sessions to plan mode (e.g. a SessionStart hook that injects "enter plan mode on every new session") forces ToolSearch to load these schemas at session start, producing tool_reference blocks every single session.

In my project's session directory (~/.claude/projects/<project-hash>/), 124 of the session JSONLs contain tool_reference blocks; 236 such blocks total. So this widget appears in essentially every active session.

Steps to reproduce

  1. Have a SessionStart hook (or a /loop / /autonomous / /autopilot invocation) that enters plan mode automatically.
  2. Start a new session in the VS Code extension. The first user message will trigger a ToolSearch call to load EnterPlanMode/ExitPlanMode schemas.
  3. Scroll the conversation. The message containing the ToolSearch tool_result renders as a red error widget instead of normal content.

Expected behavior

The renderer should have a case for type: "tool_reference" — either render it as a small badge (e.g. "📎 EnterPlanMode schema loaded") or hide it silently.

Actual behavior

Red error widget showing:

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

Looks like a fatal error to users, but is purely a renderer fallthrough.

Environment

  • Claude Code VS Code extension v2.1.141
  • VS Code on Windows 11
  • Repro on every session that uses plan mode

Severity

Cosmetic — the underlying session data is intact and the conversation works fine. But it looks alarming and reads as a real failure. Users investigating "twice in a row" red errors waste real time tracking it down (which is how I found this).

Suggested fix

Add a case branch in the message-content-block renderer for type: "tool_reference". Could be as minimal as return null or a small chip showing which deferred tool was loaded.## Summary The Claude Code VS Code extension (v2.1.141) cannot render content blocks of type: "tool_reference" in the conversation history. The message renderer falls through to its default branch and outputs the literal string Unhandled case: [object Object] followed by a generic "View output logs · Troubleshooting resources" error footer.

Where the malformed-looking blocks come from

tool_reference blocks are returned by the ToolSearch tool whenever it loads a deferred tool's JSONSchema definition. Each block has just two keys:

{ "type": "tool_reference", "tool_name": "EnterPlanMode" }

They're wrapped inside a tool_result and live in the persisted session JSONL.

Why this is high-volume

Plan-mode (EnterPlanMode / ExitPlanMode) is a deferred tool. Any environment that defaults new sessions to plan mode (e.g. a SessionStart hook that injects "enter plan mode on every new session") forces ToolSearch to load these schemas at session start, producing tool_reference blocks every single session.

In my project's session directory (~/.claude/projects/<project-hash>/), 124 of the session JSONLs contain tool_reference blocks; 236 such blocks total. So this widget appears in essentially every active session.

Steps to reproduce

  1. Have a SessionStart hook (or a /loop / /autonomous / /autopilot invocation) that enters plan mode automatically.
  2. Start a new session in the VS Code extension. The first user message will trigger a ToolSearch call to load EnterPlanMode/ExitPlanMode schemas.
  3. Scroll the conversation. The message containing the ToolSearch tool_result renders as a red error widget instead of normal content.

Expected behavior

The renderer should have a case for type: "tool_reference" — either render it as a small badge (e.g. "📎 EnterPlanMode schema loaded") or hide it silently.

Actual behavior

Red error widget showing:

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

Looks like a fatal error to users, but is purely a renderer fallthrough.

Environment

  • Claude Code VS Code extension v2.1.141
  • VS Code on Windows 11
  • Repro on every session that uses plan mode

Severity

Cosmetic — the underlying session data is intact and the conversation works fine. But it looks alarming and reads as a real failure. Users investigating "twice in a row" red errors waste real time tracking it down (which is how I found this).

Suggested fix

Add a case branch in the message-content-block renderer for type: "tool_reference". Could be as minimal as return null or a small chip showing which deferred tool was loaded.

<img width="469" height="44" alt="Image" src="https://github.com/user-attachments/assets/a19dfe33-d4e2-49f6-a850-e2b6763dc8d0" />

What Should Happen?

The renderer should have a case for type: "tool_reference" — either render it as a small badge (e.g. "📎 EnterPlanMode schema loaded") or hide it silently.

Error Messages/Logs

Steps to Reproduce

Steps to reproduce

  1. Have a SessionStart hook (or a /loop / /autonomous / /autopilot invocation) that enters plan mode automatically.
  2. Start a new session in the VS Code extension. The first user message will trigger a ToolSearch call to load EnterPlanMode/ExitPlanMode schemas.
  3. Scroll the conversation. The message containing the ToolSearch tool_result renders as a red error widget instead of normal content.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

v2.1.141

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The renderer should have a case for type: "tool_reference" — either render it as a small badge (e.g. "📎 EnterPlanMode schema loaded") or hide it silently.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] VS Code extension renders tool_reference content blocks as "Unhandled case: [object Object]"