AI_TypeValidationError on Grok Fast 1 (Opencode Zen mode) #3648

Closed
opened 2026-02-16 17:40:59 -05:00 by yindo · 3 comments
Owner

Originally created by @mynameistito on GitHub (Dec 18, 2025).

Originally assigned to: @fwang on GitHub.

Description

Description

When using the Grok Fast 1 model in Opencode Zen mode, the application throws a AI_TypeValidationError.

It appears that when the Grok API returns a "Service Unavailable" response, the error payload does not conform to the expected schema defined in the Opencode validation logic. Specifically, the validator expects an object for the error field or an array for choices, but receives a flat string within the error field instead.

Steps to Reproduce

  1. Open Opencode.
  2. Select the Grok Fast 1 - Opencode zen model.
  3. Send any prompt.
  4. The UI/Console returns the AI_TypeValidationError.

Error Logs

AI_TypeValidationError: Type validation failed: Value: {"code":"The service is currently unavailable","error":"Service temporarily unavailable. The model did not respond to this request."}.
Error message: [{"code":"invalid_union","errors":[[{"expected":"array","code":"invalid_type","path":["choices"],"message":"Invalid input: expected array, received undefined"}],[{"expected":"object","code":"invalid_type","path":["error"],"message":"Invalid input: expected object, received string"}]],"path":[],"message":"Invalid input"}]

System

OS: Windows 10
OpenCode Version: 1.0.167
Node: 25.2.1
Method: TUI via Windows Terminal

Originally created by @mynameistito on GitHub (Dec 18, 2025). Originally assigned to: @fwang on GitHub. ### Description ## Description When using the **Grok Fast 1** model in **Opencode Zen** mode, the application throws a `AI_TypeValidationError`. It appears that when the Grok API returns a "Service Unavailable" response, the error payload does not conform to the expected schema defined in the Opencode validation logic. Specifically, the validator expects an object for the `error` field or an array for `choices`, but receives a flat string within the error field instead. ## Steps to Reproduce 1. Open **Opencode**. 3. Select the **Grok Fast 1 - Opencode zen** model. 4. Send any prompt. 5. The UI/Console returns the `AI_TypeValidationError`. ## Error Logs ```bash AI_TypeValidationError: Type validation failed: Value: {"code":"The service is currently unavailable","error":"Service temporarily unavailable. The model did not respond to this request."}. Error message: [{"code":"invalid_union","errors":[[{"expected":"array","code":"invalid_type","path":["choices"],"message":"Invalid input: expected array, received undefined"}],[{"expected":"object","code":"invalid_type","path":["error"],"message":"Invalid input: expected object, received string"}]],"path":[],"message":"Invalid input"}] ``` ## System **OS:** Windows 10 **OpenCode Version:** 1.0.167 **Node:** 25.2.1 **Method:** TUI via Windows Terminal
yindo added the windowsbugzen labels 2026-02-16 17:40:59 -05:00
yindo closed this issue 2026-02-16 17:40:59 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 18, 2025):

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

  • #5031: Inconsistent AI_TypeValidationError when submitting requests (same error with Grok Code Fast 1 when API returns service unavailability responses)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Dec 18, 2025): This issue might be a duplicate of existing issues. Please check: - #5031: Inconsistent AI_TypeValidationError when submitting requests (same error with Grok Code Fast 1 when API returns service unavailability responses) Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Dec 18, 2025):

that error comes from xai we can parse and retry automatically tho

@rekram1-node commented on GitHub (Dec 18, 2025): that error comes from xai we can parse and retry automatically tho
Author
Owner

@rekram1-node commented on GitHub (Dec 18, 2025):

Should retry in next release automatically

@rekram1-node commented on GitHub (Dec 18, 2025): Should retry in next release automatically
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3648