You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI: --file flag attaches images with incorrect MIME type, breaking multimodal support #24698
When using the opencode run --file flag with an image file (such as PNG or JPG), the CLI sets the MIME type to text/plain regardless of the file extension. As a result, image attachments are not recognized as images by LLMs or the OpenCode server—they are not handled as multimodal inputs, so image models are not triggered as expected.
Attempts to work around this with a plugin are not effective, because the CLI constructs the "file" part with the wrong MIME type before any plugin hooks run. A proper solution would detect and set common image MIME types (e.g., image/png, image/jpeg) for recognized file extensions whenever the --file flag is used.
This limitation breaks workflows that need to send screenshots or reference images through CLI-driven code automation.
Plugins
No response
OpenCode version
No response
Steps to reproduce
Run opencode run --file path/to/screenshot.png "Describe this screenshot"
Notice that the image is sent as a plain file (MIME type: text/plain), not as an image/multimodal input.
No way to force correct MIME with only CLI options; issue persists even with plugins.
Activity
github-actions commentedon Apr 28, 2026
This issue might be a duplicate of existing issues. Please check:
run --filehardcodestext/plainMIME type for all files #16723:run --filehardcodestext/plainMIME type for all files — same root cause and behavior described heregithub-actions commentedon Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.