claude-code - 💡(How to fix) Fix VSCode extension 2.1.119: /clear routes to phantom session (webview sends session_id:"" in io_message) [1 participants]

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…
GitHub stats
anthropics/claude-code#52888Fetched 2026-04-25 06:18:13
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
1
Participants
Timeline (top)
labeled ×4cross-referenced ×1

In the Claude Code VS Code extension 2.1.119, typing /clear in the webview panel does not clear the session. Instead:

  1. A literal /clear user message is appended to the transcript.
  2. The backend runs a SessionStart:clear hook against a freshly invented session UUID (a phantom).
  3. The real session — UI, transcript, backend conversation state — is untouched.

Each failed /clear also leaves a ~15,719-byte orphan .jsonl in ~/.claude/projects/<workspace-slug>/.

Root Cause

Root cause (from extension log)

Fix Action

Workaround

The "+" new-conversation button in the Claude panel tears down and replaces the current session (new channelId), producing a usable fresh session. However, the new session's io_message still sends session_id:"" — the underlying bug is unfixed, /clear remains broken inside the new session too. "+" is a substitute for /clear, not a fix.

The Command Palette's "Chat: New Claude Session" opens a pane but returns "Language model unavailable" when typed into (separate issue — extension is registered as a chat participant but no vscode.lm.* language-model provider is available).

Code Example

Received message from webview: {"type":"io_message","channelId":"ltkpcwbdkbg","message":{"type":"user","uuid":"3180fabe-...","session_id":"","parent_tool_use_id":null,"message":{"role":"user","content":[{"type":"text","text":"/clear"}]}},"done":false}
RAW_BUFFERClick to expand / collapse

Summary

In the Claude Code VS Code extension 2.1.119, typing /clear in the webview panel does not clear the session. Instead:

  1. A literal /clear user message is appended to the transcript.
  2. The backend runs a SessionStart:clear hook against a freshly invented session UUID (a phantom).
  3. The real session — UI, transcript, backend conversation state — is untouched.

Each failed /clear also leaves a ~15,719-byte orphan .jsonl in ~/.claude/projects/<workspace-slug>/.

Root cause (from extension log)

Inside a single panel session, the webview sends two kinds of messages with inconsistent session-id fields:

  • update_session_state, get_session_request, generate_session_title carry the real session UUID in camelCase sessionId.
  • io_message (the user-input path, which /clear travels on) carries snake_case session_id and it is always "".

Example from my log (~/Library/Application Support/Code/logs/<ts>/window<n>/exthost/Anthropic.claude-code/Claude VSCode.log):

Received message from webview: {"type":"io_message","channelId":"ltkpcwbdkbg","message":{"type":"user","uuid":"3180fabe-...","session_id":"","parent_tool_use_id":null,"message":{"role":"user","content":[{"type":"text","text":"/clear"}]}},"done":false}

The same panel simultaneously sends update_session_state messages with a real sessionId like 138e792d-c46d-4a5b-8aa2-e340780da07d — so the webview knows the session UUID, it just fails to include it in the io_message payload.

Reproduction

  1. Open the Claude panel in VS Code (extension 2.1.119).
  2. Start any conversation.
  3. Type /clear.
  4. Observe: transcript not cleared; log shows io_message with session_id:"".

Reproduces 100% on two independent Macs with byte-identical bundled CLI binaries (md5 5a7d1122478a89aee9fc9cfe72d8133f).

Ruled out (not the cause)

  • iCloud-symlinked ~/.claude directory
  • Custom slash commands, plugin manifests, hooks in settings.json, ~/.claude.json overrides
  • VS Code workspace/global state.vscdb contents
  • PATH claude install (extension uses its bundled resources/native-binary/claude)

The plain-terminal claude CLI's /clear works normally with the same ~/.claude config, which points to a webview-side defect rather than a backend or config issue.

Workaround

The "+" new-conversation button in the Claude panel tears down and replaces the current session (new channelId), producing a usable fresh session. However, the new session's io_message still sends session_id:"" — the underlying bug is unfixed, /clear remains broken inside the new session too. "+" is a substitute for /clear, not a fix.

The Command Palette's "Chat: New Claude Session" opens a pane but returns "Language model unavailable" when typed into (separate issue — extension is registered as a chat participant but no vscode.lm.* language-model provider is available).

Related

Possibly adjacent: #26794 (/clear sets SessionStart hook source to startup instead of clear) — that's a hook-parameter bug; this is a routing bug where /clear never reaches the real session at all.

Environment

  • Claude Code VS Code extension: 2.1.119 (anthropic.claude-code-2.1.119-darwin-arm64)
  • VS Code: 1.117.0, commit 10c8e557c8b9f9ed0a87f61f1c9a44bde731c409, arm64
  • macOS: 26.3.1 (build 25D2128)
  • Reproduces on two Macs independently

extent analysis

TL;DR

The issue can be worked around by using the "+" new-conversation button in the Claude panel to create a new session, although this does not fix the underlying bug.

Guidance

  • The root cause of the issue is the inconsistent session-id fields in messages sent by the webview, with io_message carrying an empty session_id field.
  • To verify the issue, check the extension log for messages with session_id:"" and observe that the transcript is not cleared when typing /clear.
  • The underlying bug can be mitigated by modifying the webview to include the real session UUID in the io_message payload, but this requires changes to the extension code.
  • As a temporary workaround, users can use the "+" new-conversation button to create a new session, which will allow them to start a fresh conversation.

Example

No code snippet is provided as the issue is related to the extension's internal logic and requires changes to the extension code.

Notes

The issue is specific to the Claude Code VS Code extension version 2.1.119 and may not affect other versions. The workaround provided may not be a permanent fix and may have unintended consequences.

Recommendation

Apply workaround: Use the "+" new-conversation button to create a new session when needed, as this provides a usable fresh session, although it does not fix the underlying bug.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING