[BUG] VS Code extension renders tool_reference content blocks as "Unhandled case: [object Object]"
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
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
- Have a SessionStart hook (or a
/loop//autonomous//autopilotinvocation) that enters plan mode automatically. - Start a new session in the VS Code extension. The first user message will trigger a
ToolSearchcall to loadEnterPlanMode/ExitPlanModeschemas. - Scroll the conversation. The message containing the ToolSearch
tool_resultrenders 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
- Have a SessionStart hook (or a
/loop//autonomous//autopilotinvocation) that enters plan mode automatically. - Start a new session in the VS Code extension. The first user message will trigger a
ToolSearchcall to loadEnterPlanMode/ExitPlanModeschemas. - Scroll the conversation. The message containing the ToolSearch
tool_resultrenders 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
- Have a SessionStart hook (or a
/loop//autonomous//autopilotinvocation) that enters plan mode automatically. - Start a new session in the VS Code extension. The first user message will trigger a
ToolSearchcall to loadEnterPlanMode/ExitPlanModeschemas. - Scroll the conversation. The message containing the ToolSearch
tool_resultrenders 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_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗