Skip to content

Tool progress messages rejected by streaming validator due to invalid union type #36428

Closed as not planned

Description

@maystri21store-pixel

Version

opencode 1.17.18

What happened

When opencode runs tool calls, it sometimes fails with:

Opencode failed to send message with error: Type validation failed:
Value: {"tool":"search_files","emoji":"🔎","label":"*","toolCallId":"call_00_ldqno5lweRBQjYVaLOab5496","status":"running"}

[ { "code": "invalid_union", "errors": [
[ { "expected": "array", "code": "invalid_type", "path": [ "choices" ] } ],
[ { "expected": "object", "code": "invalid_type", "path": [ "error" ] } ]
] } ]

Root cause

Tool progress/status messages ({tool, emoji, label, toolCallId, status}) are being sent through the same streaming channel as OpenAI-format response chunks. The Zod union validator on that endpoint expects either {"choices": [...]} or {"error": {...}}. The progress message structure matches neither variant.

Suggested fix

Either send progress messages through a separate channel, or wrap them in a valid format (e.g. add an empty choices array or nest the progress data as a sub-field of a valid message).

Activity

  1. github-actions commented on Jul 11, 2026

    @github-actions
    Contributor

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

  2. github-actions commented on Sep 10, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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