Skip to content

opencode run -f mislabels local file attachments as text/plain #38952

Closed

Description

@wonderfulremark

Description

opencode run -f <path> (no --attach) always sets the attachment's mime to text/plain (or application/x-directory for a directory), regardless of the file's actual type. The correct mime is computed via FSUtil.mimeType() right above it but never used for this branch, and that call is also never awaited (it's an async function).

Effect: any non-text local attachment - an image, for example - gets sent to the model mislabeled as text/plain instead of e.g. image/png.

OpenCode version

1.18.5

Steps to reproduce

  1. opencode run -m ollama/<vision-capable-model> --agent plan --print-logs --log-level DEBUG -f ./some-image.png -- "what does this image show?"
  2. Check the logs: message=file mime=text/plain even though the attached file is a PNG.

Operating System

Linux

Activity

  1. github-actions commented on Jul 26, 2026

    @github-actions
    Contributor

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

  2. wonderfulremark commented on Jul 26, 2026

    @wonderfulremark
    Author

    Duplicate of #34318 - already reported. Closing.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions