Skip to content

Support AVIF images or auto-convert to supported format before sending to API #17772

@RaviTharuma

Description

@RaviTharuma

Description

When OpenCode reads AVIF images (e.g., from downloaded Webflow assets) and sends them to the Anthropic API for vision/multimodal analysis, the API rejects them because AVIF is not a supported media type.

Steps to Reproduce

  1. Have AVIF images in a directory (e.g., downloaded from Webflow)
  2. Use an agent with multimodal capabilities to analyze the images
  3. The agent reads the .avif file and sends it to the API

Expected Behavior

OpenCode should either:

  • Auto-convert AVIF to a supported format (PNG/JPEG/WebP) before sending to the API
  • Or skip unsupported formats gracefully with a clear warning

Actual Behavior

The API returns a validation error in an infinite loop:

messages.502.content.0.tool_result.content.1.image.source.base64.media_type: Input should be 'image/jpeg', 'image/png', 'image/gif' or 'image/webp'

Additionally, if the file doesn't exist:

ENOENT: no such file or directory, open '/tmp/wf-imgs/659d681d7b333c788f3209b2_patrick-riedel_square.avif'

The agent enters a retry loop hitting the same error repeatedly.

Additional Context

  • AVIF is increasingly common on modern websites (Webflow, Squarespace, etc.)
  • macOS has native AVIF→PNG conversion via sips -s format png input.avif --out output.png
  • The Anthropic API supports: image/jpeg, image/png, image/gif, image/webp

Environment

  • OpenCode v1.2.26
  • macOS (Darwin 25.3.0)
  • Anthropic API via Quotio proxy

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

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