[BUG]: Unhandled ENOENT error when submitting a message with a deleted file attachment #6422

Open
opened 2026-02-16 18:04:10 -05:00 by yindo · 1 comment
Owner

Originally created by @ochen1 on GitHub (Jan 15, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

When a user attaches a file (e.g., @somefile.txt) to a message, but deletes that file from the file system before submitting the message, OpenCode crashes.

Bun.file(filepath).stat() throws an unhandled ENOENT error that prints raw to the TUI, breaking the display.

Plugins

No response

OpenCode version

No response

Steps to reproduce

  1. Attach/mention a file in the input (e.g., @somefile.txt).
  2. Delete the file from the file system.
  3. Submit the message (Enter).

Alternatively (simpler):

  1. attach/mention (e.g., @somefile.txt) any file and ask OpenCode to delete it (wait for completion)
  2. up arrow, enter

Screenshot and/or share link

Screenshot 2026-01-02 105744

Operating System

Ubuntu 24.04

Terminal

Visual Studio Code Insiders

Originally created by @ochen1 on GitHub (Jan 15, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description When a user attaches a file (e.g., `@somefile.txt`) to a message, but deletes that file from the file system before submitting the message, OpenCode crashes. `Bun.file(filepath).stat()` throws an unhandled `ENOENT` error that prints raw to the TUI, breaking the display. ### Plugins _No response_ ### OpenCode version _No response_ ### Steps to reproduce 1. Attach/mention a file in the input (e.g., `@somefile.txt`). 2. Delete the file from the file system. 3. Submit the message (Enter). Alternatively (simpler): 1. attach/mention (e.g., `@somefile.txt`) any file and ask OpenCode to delete it (wait for completion) 2. up arrow, enter ### Screenshot and/or share link <img width="1801" height="1327" alt="Screenshot 2026-01-02 105744" src="https://github.com/user-attachments/assets/e4adabab-2b37-4110-b8f6-66e71d036dde" /> ### Operating System Ubuntu 24.04 ### Terminal Visual Studio Code Insiders
yindo added the opentuibug labels 2026-02-16 18:04:10 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 15, 2026):

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

  • #4011: bug: referencing file causes issue

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

@github-actions[bot] commented on GitHub (Jan 15, 2026): This issue might be a duplicate of existing issues. Please check: - #4011: bug: referencing file causes issue Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6422