Description
Bug Description
Selecting any Cloudflare Workers AI model causes AiError: Bad input with schema validation failure. Messages are sent with inconsistent content field types in the same request.
Error
Bad Request: {"errors":{"message":"AiError: Bad input: Error: oneOf at '/' not met, 0 matches: required properties at '/' are 'prompt', Type mismatch of '/messages/0/content', 'array' not in 'string', Type mismatch of '/messages/1/content', 'string' not in 'array', required properties at '/messages/1' are 'role,content' (d9e09afe-fe49-4051-bc1d-8901f858ff52)","code":5006},"success":false,"result":{},"messages":[]}
Root Cause
A mix of Anthropic-style and OpenAI-style message formats in the same request:
- Some messages have
content as an array ([{type: "text", text: "..."}])
- Others have
content as a string ("...")
Cloudflare Workers AI expects OpenAI-compatible schema where content type is consistent.
To Reproduce
- Configure opencode with Cloudflare Workers AI as provider
- Select any Cloudflare Workers AI model
- Start a conversation — error appears immediately
Environment
- opencode version: 1.15.5 (Homebrew)
- Provider: Cloudflare Workers AI
- Platform: macOS
- No custom system prompt
Plugins
superpowers
OpenCode version
1.15.13
Steps to reproduce
- Configure opencode with Cloudflare Workers AI as provider
- Select any Cloudflare Workers AI model
- Start a conversation — error appears immediately
Screenshot and/or share link
Operating System
macOS 26.4.1 (25E253)
Terminal
Terminal
Description
Bug Description
Selecting any Cloudflare Workers AI model causes
AiError: Bad inputwith schema validation failure. Messages are sent with inconsistentcontentfield types in the same request.Error
Bad Request: {"errors":{"message":"AiError: Bad input: Error: oneOf at '/' not met, 0 matches: required properties at '/' are 'prompt', Type mismatch of '/messages/0/content', 'array' not in 'string', Type mismatch of '/messages/1/content', 'string' not in 'array', required properties at '/messages/1' are 'role,content' (d9e09afe-fe49-4051-bc1d-8901f858ff52)","code":5006},"success":false,"result":{},"messages":[]}
Root Cause
A mix of Anthropic-style and OpenAI-style message formats in the same request:
contentas an array ([{type: "text", text: "..."}])contentas a string ("...")Cloudflare Workers AI expects OpenAI-compatible schema where content type is consistent.
To Reproduce
Environment
Plugins
superpowers
OpenCode version
1.15.13
Steps to reproduce
Screenshot and/or share link
Operating System
macOS 26.4.1 (25E253)
Terminal
Terminal