claude-code - 💡(How to fix) Fix VS Code extension: chat-panel link handler routes binary files through tryOpenDocument (text-only), bypassing editor associations [1 comments, 2 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#55101Fetched 2026-05-01 05:46:15
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×5commented ×1

Markdown links in the Claude Code VS Code extension chat panel route through a text-document open path. Clicking a link to a binary file (e.g. .mp4, .png, .pdf, .zip) silently fails with no user feedback.

Error Message

[Extension Host] rejected promise not handled within 1 second: CodeExpectedError: cannot open file:///.../render.mp4. Detail: File seems to be binary and cannot be opened as text at h_e.$tryOpenDocument (vscode-file://.../workbench.desktop.main.js:1005:10890)

Root Cause

The link handler calls $tryOpenDocument rather than vscode.open / vscode.openWith. Because $tryOpenDocument is the text-document path, it rejects all binary content and never reaches the editor-association resolver — so installing an extension that handles .mp4 (e.g. MPEG-4 Preview) and setting workbench.editorAssociations has no effect on chat-panel link clicks. VS Code's own built-in Video Preview is also bypassed.

Fix Action

Fix / Workaround

Impact

Users producing or referencing binary artifacts in chat (video renders, screenshots, generated PDFs) can't click through. The current workaround is right-click in the Explorer sidebar → Reveal in Finder, which defeats the point of having clickable file references in chat output.

Code Example

[Extension Host] rejected promise not handled within 1 second:
CodeExpectedError: cannot open file:///.../render.mp4. Detail: File seems to be binary and cannot be opened as text
    at h_e.$tryOpenDocument (vscode-file://.../workbench.desktop.main.js:1005:10890)
RAW_BUFFERClick to expand / collapse

Summary

Markdown links in the Claude Code VS Code extension chat panel route through a text-document open path. Clicking a link to a binary file (e.g. .mp4, .png, .pdf, .zip) silently fails with no user feedback.

Repro

  1. In a Claude Code panel chat reply, render a markdown link like [render.mp4](path/to/render.mp4) (relative or absolute).
  2. Click (or Cmd+Click) the link.
  3. Nothing visible happens.

Expected

The file opens — either via VS Code's built-in viewer (e.g. the built-in Video Preview for .mp4), via a user-configured workbench.editorAssociations mapping, or via the OS default app.

Actual

DevTools console shows:

[Extension Host] rejected promise not handled within 1 second:
CodeExpectedError: cannot open file:///.../render.mp4. Detail: File seems to be binary and cannot be opened as text
    at h_e.$tryOpenDocument (vscode-file://.../workbench.desktop.main.js:1005:10890)

The link handler calls $tryOpenDocument rather than vscode.open / vscode.openWith. Because $tryOpenDocument is the text-document path, it rejects all binary content and never reaches the editor-association resolver — so installing an extension that handles .mp4 (e.g. MPEG-4 Preview) and setting workbench.editorAssociations has no effect on chat-panel link clicks. VS Code's own built-in Video Preview is also bypassed.

Impact

Users producing or referencing binary artifacts in chat (video renders, screenshots, generated PDFs) can't click through. The current workaround is right-click in the Explorer sidebar → Reveal in Finder, which defeats the point of having clickable file references in chat output.

Suggested fix

For chat-panel markdown links pointing at workspace or absolute file URIs, use vscode.commands.executeCommand('vscode.open', uri) (or vscode.openWith to honor user editor associations) instead of $tryOpenDocument. That delegates to VS Code's normal resolution chain — built-in viewers, user-configured associations, and external apps as configured.

Environment

  • VS Code (Mac, Darwin 24.6.0)
  • Claude Code VS Code extension (panel UI)
  • File: standard .mp4 (H.264) on local disk, path contains URL-encoded spaces (%20)

extent analysis

TL;DR

Use vscode.commands.executeCommand('vscode.open', uri) instead of $tryOpenDocument to handle markdown links to binary files in the Claude Code VS Code extension chat panel.

Guidance

  • Identify the link handler code in the Claude Code extension that calls $tryOpenDocument and replace it with vscode.commands.executeCommand('vscode.open', uri) to delegate to VS Code's normal resolution chain.
  • Alternatively, use vscode.openWith to honor user editor associations for binary files.
  • Verify the fix by clicking on a markdown link to a binary file (e.g. .mp4) in the chat panel and checking if it opens correctly in the associated app or VS Code's built-in viewer.
  • Test the fix with different types of binary files (e.g. .png, .pdf, .zip) to ensure it works as expected.

Example

// Replace this line:
$tryOpenDocument(uri);

// With this:
vscode.commands.executeCommand('vscode.open', uri);

Notes

This fix assumes that the Claude Code extension has access to the vscode API and can execute commands. If the extension uses a different API or has limitations, additional modifications may be necessary.

Recommendation

Apply the suggested fix by replacing $tryOpenDocument with vscode.commands.executeCommand('vscode.open', uri) to enable correct handling of markdown links to binary files in the chat panel.

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