anomalyco / anomalyco/opencode
Pasting multiple images in one session overwrites each other (all saved as image.png)
@jlongster is already working on this.
Since Aug 14, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
When pasting two or more images into the same opencode session, every image is saved to the same fixed path ~/.local/share/opencode/attachments/{session_id}/image.png. Later images overwrite earlier ones, so the model only ever has access to the last image — even if the model itself supports vision.
Steps to reproduce
- Paste screenshot A into a session.
- Paste screenshot B into the same session (same message or a follow-up).
- Ask the model to describe both images.
Actual behavior
Only B is accessible. The system attachment notice is byte-identical for both pastes:
[图片附件] 用户粘贴的图片 "image.png" 已保存到本地文件:
~\.local\share\opencode\attachments\ses_xxx\image.png
Evidence
Each session directory contains exactly one file named image.png. After pasting two different images, only the last-written one exists (e.g. 33,707 bytes at the second paste time); the first image is gone. All historical session dirs show the same single-image.png pattern, confirming pasted images use a fixed filename instead of a unique/hashed name.
Expected behavior
Each pasted image should get a unique filename (e.g. image-<timestamp>.png or a content hash) so multiple images in one session coexist and are all passed to the model.
Workaround
Paste images one at a time, or save them with distinct filenames before attaching (dragging in a file preserves its original name).
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.