Cannot past image urls into the TUI #2841

Closed
opened 2026-02-16 17:37:29 -05:00 by yindo · 5 comments
Owner

Originally created by @rickross on GitHub (Nov 13, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

When I try to paste an image url to the agent it just does nothing. I cannot paste the url nor does it seem to paste the actual image. I would like to just paste the image url without pasting the image. Is there a way to do this?

OpenCode version

1.0.62

Steps to reproduce

  1. Grab an image url (mine are mostly Cloudflare R2 references to .webp images
  2. Try to paste it into the TUI input area

On mine, nothing happens at all.

Screenshot and/or share link

No response

Operating System

MacOS Tahoe 26.1

Terminal

iTerm2

Originally created by @rickross on GitHub (Nov 13, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description When I try to paste an image url to the agent it just does nothing. I cannot paste the url nor does it seem to paste the actual image. I would like to just paste the image url without pasting the image. Is there a way to do this? ### OpenCode version 1.0.62 ### Steps to reproduce 1. Grab an image url (mine are mostly Cloudflare R2 references to .webp images 2. Try to paste it into the TUI input area On mine, nothing happens at all. ### Screenshot and/or share link _No response_ ### Operating System MacOS Tahoe 26.1 ### Terminal iTerm2
yindo added the opentuibug labels 2026-02-16 17:37:29 -05:00
yindo closed this issue 2026-02-16 17:37:30 -05:00
Author
Owner

@rickross commented on GitHub (Nov 14, 2025):

Looking at the current upstream code (v1.0.62), the bug is in:
File: packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
Lines 676-695 (approximately):

const filepath = pastedContent.replace(/^'+|'+$/g, "").replace(/\\ /g, " ")
console.log(pastedContent, filepath)
try {
  const file = Bun.file(filepath)
  if (file.type.startsWith("image/")) {
    event.preventDefault()  // Line ~681 - blocks paste before verifying file exists
    const content = await file
      .arrayBuffer()
      .then((buffer) => Buffer.from(buffer).toString("base64"))
      .catch(console.error)
    if (content) {
      await pasteImage({
        filename: file.name,
        mime: file.type,
        content,
      })
      return
    }
  }
} catch {}  // Line ~695 - silently swallows the error

The specific issue: event.preventDefault() is called at line ~681 before checking if the file can actually be read, and there's no URL fetching logic - only local file handling via Bun.file().

@rickross commented on GitHub (Nov 14, 2025): Looking at the current upstream code (v1.0.62), the bug is in: File: packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx Lines 676-695 (approximately): ``` const filepath = pastedContent.replace(/^'+|'+$/g, "").replace(/\\ /g, " ") console.log(pastedContent, filepath) try { const file = Bun.file(filepath) if (file.type.startsWith("image/")) { event.preventDefault() // Line ~681 - blocks paste before verifying file exists const content = await file .arrayBuffer() .then((buffer) => Buffer.from(buffer).toString("base64")) .catch(console.error) if (content) { await pasteImage({ filename: file.name, mime: file.type, content, }) return } } } catch {} // Line ~695 - silently swallows the error ``` The specific issue: event.preventDefault() is called at line ~681 before checking if the file can actually be read, and there's no URL fetching logic - only local file handling via Bun.file().
Author
Owner

@rekram1-node commented on GitHub (Nov 16, 2025):

Nice find we will fix

@rekram1-node commented on GitHub (Nov 16, 2025): Nice find we will fix
Author
Owner

@MeysamNajafi commented on GitHub (Nov 22, 2025):

Just to clarify—this seems like a feature request to support pasting image URLs directly into the TUI, where the URL would be treated as an image input. I haven't seen this in similar tools like Claude Code, but if the OpenCode team thinks this is a valuable addition, I'm willing to work on implementing it. Let me know if you'd like me to proceed with a PR.

@MeysamNajafi commented on GitHub (Nov 22, 2025): Just to clarify—this seems like a feature request to support pasting image URLs directly into the TUI, where the URL would be treated as an image input. I haven't seen this in similar tools like Claude Code, but if the OpenCode team thinks this is a valuable addition, I'm willing to work on implementing it. Let me know if you'd like me to proceed with a PR.
Author
Owner

@rickross commented on GitHub (Nov 23, 2025):

Hi Meysam it isn't so much a feature request as a bug report. The code already tries to treat the image url as image input but can only succeed if the image is local. Otherwise it just swallows the input and prevents the url from being inserted into the message as text. This tends to interfere in messages that involve discussing or debugging the behavior of image urls. I am working in an app context that managaes thousands of images, and this bug prevents discussing specific urls with the AI agent.

@rickross commented on GitHub (Nov 23, 2025): Hi Meysam it isn't so much a feature request as a bug report. The code already tries to treat the image url as image input but can only succeed if the image is local. Otherwise it just swallows the input and prevents the url from being inserted into the message as text. This tends to interfere in messages that involve discussing or debugging the behavior of image urls. I am working in an app context that managaes thousands of images, and this bug prevents discussing specific urls with the AI agent.
Author
Owner

@MeysamNajafi commented on GitHub (Nov 24, 2025):

Hey! You're right, I misunderstood the issue at first. I've now created above PR to fix it.
Thanks for clarifying.

@MeysamNajafi commented on GitHub (Nov 24, 2025): Hey! You're right, I misunderstood the issue at first. I've now created above PR to fix it. Thanks for clarifying.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2841