Skip to content

[BUG]: ENOENT when image URL is treated as local file path — breaks TUI rendering #10730

Closed

Description

@rynfar

Description

When a message contains a GitHub image URL (e.g., from pasting an image or referencing user-attachments), OpenCode treats the URL as a local file path and attempts to stat() it. This resolves the URL against the CWD, producing an invalid path like:

/Users/rynfar/repos/opencode-claude-provider/https:/github.com/user-attachments/assets/421a1663-bc87-449f-b50c-6a411baf6417

The Bun.file(filepath).stat() call then throws an unhandled ENOENT error that dumps raw into the TUI, breaking the display.

Root Cause

The code path that processes file attachments/content does not check whether a path is a URL (starts with http:// or https://) before calling stat(). URLs should either be fetched remotely or skipped, not treated as local filesystem paths.

Related

Similar to #8807 (same stat() code path, different trigger — deleted file vs URL-as-path).

Steps to reproduce

  1. Start OpenCode
  2. Paste or reference an image that produces a GitHub user-attachments URL
  3. Submit the message
  4. Observe the ENOENT error rendered in the TUI

Error Output

ENOENT: no such file or directory, stat '/Users/rynfar/repos/opencode-claude-provider/https:/github.com/user-attachments/assets/421a1663-bc87-449f-b50c-6a411baf6417'
  path: "/Users/rynfar/repos/opencode-claude-provider/https:/github.com/user-attachments/assets/421a1663-bc87-449f-b50c-6a411baf6417",
  syscall: "stat",
  errno: -2,
  code: "ENOENT"

Expected behavior

URLs should be recognized as remote resources and not passed to stat(). The code should check if a path starts with http:// or https:// before attempting filesystem operations.

Operating System

macOS

Terminal

Terminal / OpenCode TUI

OpenCode version

Latest

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Jan 26, 2026
  2. github-actions commented on Jan 26, 2026

    @github-actions
    Contributor

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

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

  3. github-actions commented on Mar 29, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions