GeezerVison is showing github.com — bug: text content blocks must be non-empty in custom provider · Issue #16332 · anomalyco/opencode
bug: text content blocks must be non-empty in custom provider #16332Labels bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff) DescriptionDescription
I use Figma mcp and skill to create React component, chat is ok in TUI, but when it downloads img from figma, there is a error stop tasks.
skill: https://skills.sh/figma/mcp-server-guide/implement-design
mcp: https://github.com/figma/mcp-server-guide
"mcp": {
"figma": {
"type": "remote",
"url": "https://mcp.figma.com/mcp",
"enabled": true,
},
},
provider config
"xxx": {
"name": "xxx",
"npm": "@ai-sdk/openai-compatible",
"models": {
"claude-sonnet-4-5-20250929": {
"name": "claude sonnet 4.5",
},
},
"options": {
"baseURL": "xxx",
"apiKey": "xxx",
},
},
error
InvokeModelWithResponseStream: operation error Bedrock Runtime: InvokeModelWithResponseStream,
https response error StatusCode: 400, RequestID: e0741fc6-7c69-4ac5-bbe5-941f009e79fc,
ValidationException: messages: text content blocks must be non-empty
logs
ERROR 2026-03-06T06:44:14 +1ms service=llm providerID=xxx modelID=claude-sonnet-4-5-20250929 sessionID=ses_33e1c3fe3ffeRM9DMKE2gFIm45 small=false agent=build mode=primary error={"error":{}} stream error
ERROR 2026-03-06T06:44:14 +1ms service=session.processor error="/chat/completions" cannot be parsed as a URL. stack="TypeError: \"/chat/completions\" cannot be parsed as a URL.\n at URL (unknown)\n at url (../../node_modules/.bun/@[email protected]+d6123d32214422cb/node_modules/@ai-sdk/openai-compatible/dist/index.mjs:1428:23)\n at doStream (../../node_modules/.bun/@[email protected]+d6123d32214422cb/node_modules/@ai-sdk/openai-compatible/dist/index.mjs:468:24)\n at processTicksAndRejections (native:7:39)" process
INFO 2026-03-06T06:44:14 +1ms service=bus type=session.error publishing
INFO 2026-03-06T06:44:14 +0ms service=bus type=session.status publishing
INFO 2026-03-06T06:44:14 +0ms service=bus type=session.idle publishing
INFO 2026-03-06T06:44:14 +0ms service=bus type=message.updated publishing
INFO 2026-03-06T06:44:14 +1ms service=session.compaction pruning
INFO 2026-03-06T06:44:14 +0ms service=session.prompt sessionID=ses_33e1c3fe3ffeRM9DMKE2gFIm45 cancel
INFO 2026-03-06T06:44:14 +0ms service=bus type=session.status publishing
INFO 2026-03-06T06:44:14 +0ms service=bus type=session.idle publishing
INFO 2026-03-06T06:44:14 +1ms service=session.compaction pruned=0 total=0 found
INFO 2026-03-06T06:44:16 +1292ms service=bus type=session.updated publishing
INFO 2026-03-06T06:44:58 +42099ms service=default worker shutting down
INFO 2026-03-06T06:44:58 +1ms service=default disposing all instances
INFO 2026-03-06T06:44:58 +0ms service=bus type=* unsubscribing
Plugins
No response
OpenCode version
1.2.20
Steps to reproduce
- copy figma link
- in tui
make a component <figma_link>
Screenshot and/or share link
Operating System
macOS 15.1
Terminal
Ghostty Activityadded coreAnything pertaining to core functionality of the application (opencode server stuff) on Mar 6, 2026github-actions commented on Mar 6, 2026 This issue might be a duplicate of an existing issue. Please check:
If your issue is distinct (e.g. it only occurs specifically when an MCP tool returns image content from Figma), please add that clarification so this can be tracked separately. fermumen commented on Mar 10, 2026 I think this is the same as #15715
This could be fixed by changing how the filter in here works:
|
if (model.api.npm === "@ai-sdk/anthropic") { |
instead of anthropic provider, maybe we could use something that checks the model name too. e.g.
function claude(model: Provider.Model) {
if (model.providerID === "anthropic") return true
return [model.id, model.api.id].some((item) => {
const id = item.toLowerCase()
return id.includes("claude") || id.includes("anthropic")
})
}
then
if(claude(model)) ...
although you probably have a Claude detection logic for prompt selection already.
This affects another provider I'm using (databricks api endpoint of claude) added a commit that references this issue on Mar 13, 2026This issue will close once commit 33cd189 is merged into the 'dev' branch.33cd189 JackFGreen commented on Mar 23, 2026 @rekram1-node Hi, can you review this
Issue Difference: #16332 provides the verifiable reproduction path missing in #15715 (MCP tools returning attachments but empty text when Figma MCP downloads images).
PR Description: I created PR #17396 to fix the root cause where @ai-sdk/openai-compatible doesn't filter empty text blocks causing Bedrock API rejections. This PR resolves three related issues (#16332, #15715, #13811), and has been tested for a week without errors.
MetadataMetadatabugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff) DevelopmentNo branches or pull requestsIssue actions
|