Crash on Windows when pasting images from clipboard (ERR_INVALID_URL_SCHEME) #8752

Open
opened 2026-02-16 18:10:45 -05:00 by yindo · 2 comments
Owner

Originally created by @abdiths on GitHub (Feb 6, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

Pasting any image from the clipboard on Windows 11 crashes the app.

App throws TypeError: The URL must be of scheme file and the prompt fails. Happens every time an image is pasted from clipboard.

Plugins

none

OpenCode version

0.0.0-dev-202602062314

Steps to reproduce

  1. Run OpenCode on Windows
  2. Open a new session
  3. Paste any image from clipboard into the prompt input

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

No response

Originally created by @abdiths on GitHub (Feb 6, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description Pasting any image from the clipboard on Windows 11 crashes the app. App throws TypeError: The URL must be of scheme file and the prompt fails. Happens every time an image is pasted from clipboard. ### Plugins none ### OpenCode version 0.0.0-dev-202602062314 ### Steps to reproduce 1. Run OpenCode on Windows 2. Open a new session 3. Paste any image from clipboard into the prompt input ### Screenshot and/or share link <img width="762" height="518" alt="Image" src="https://github.com/user-attachments/assets/1a18d707-2122-41a7-8907-769c758d16da" /> ### Operating System Windows 11 ### Terminal _No response_
yindo added the windowsbug labels 2026-02-16 18:10:45 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 6, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #12068: Images exceeding 2000px are rejected by Anthropic API
  • #10154: Image Clipboard Paste Not Working in OpenCode
  • #10730: ENOENT when image URL is treated as local file path — breaks TUI rendering
  • #12075: tui does not support images
  • #10150: Azure gpt-5.2-codex (vision-capable) is unable to read screenshots

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 6, 2026): This issue might be a duplicate of existing issues. Please check: - #12068: Images exceeding 2000px are rejected by Anthropic API - #10154: Image Clipboard Paste Not Working in OpenCode - #10730: ENOENT when image URL is treated as local file path — breaks TUI rendering - #12075: tui does not support images - #10150: Azure gpt-5.2-codex (vision-capable) is unable to read screenshots Feel free to ignore if none of these address your specific case.
Author
Owner

@yxshee commented on GitHub (Feb 7, 2026):

#12592

Fixed crash when pasting images from clipboard on Windows 11.

Error: TypeError: The URL must be of scheme file (ERR_INVALID_URL_SCHEME)

Root Cause

In prompt.ts, the switch statement at line 946 handles URL protocols:

  • case "data:" only processes text/plain mime types, then breaks
  • For clipboard images (image/png), the condition fails and falls through to case "file:"
  • fileURLToPath() is called on a data: URL → crash
@yxshee commented on GitHub (Feb 7, 2026): #12592 Fixed crash when pasting images from clipboard on Windows 11. **Error:** `TypeError: The URL must be of scheme file (ERR_INVALID_URL_SCHEME)` ## Root Cause In [prompt.ts](cci:7://file:///Users/venom/opencode/packages/app/src/utils/prompt.ts:0:0-0:0), the switch statement at line 946 handles URL protocols: - `case "data:"` only processes `text/plain` mime types, then `break`s - For clipboard images (`image/png`), the condition fails and falls through to `case "file:"` - `fileURLToPath()` is called on a `data:` URL → **crash**
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8752