Skip to content

--file flag hardcodes text/plain for all attachments breaking image uploads #34318

Description

@MADEVAL

Description

When using the --file flag in local mode, all files are hardcoded as text/plain regardless of their actual type. Image files (PNG, JPEG, etc.) are passed to the LLM as garbled UTF-8 text instead of base64-encoded images.

Root cause: run.ts line 385 hardcodes mime to "text/plain" for all non-directory files when not in --attach mode. FSUtil.mimeType is already called on line 380 but the result is discarded. Downstream in session/prompt.ts, part.mime is trusted as-is with no re-detection, so text/plain routes images through the Read-tool text path instead of the base64 data: URL path.

Plugins

None

OpenCode version

dev branch

Steps to reproduce

  1. Run: opencode -f image.png "describe this image"
  2. The LLM receives garbled binary text instead of a base64-encoded image

Operating System

All

Terminal

All

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions