Skip to content

Zen and Go backends fail on DeepSeek V4 / MiMo tool calling with "Internal server error" #36354

Closed as not planned

Description

@santiagolu-lgtm

Description

Environment

  • OpenCode version: 1.17.18
  • OS: Windows 11

Affected providers

  • opencode (Zen)
  • opencode-go

Affected models

  • deepseek-v4-flash
  • deepseek-v4-pro
  • mimo-v2.5-pro

Error
When using these models in agent mode, OpenCode shows "Internal server error" and retries repeatedly.

Direct API test shows the backend returns:

{"error":{"message":"Error from provider (Console Go): Upstream request failed","type":"invalid_request_error","code":"invalid_request_error"}}
Verification
- Same request without tools parameter → 200 OK
- DeepSeek official API with tools → 200 OK
- Other Zen/Go models with tools → 200 OK
Working models
- Zen: hy3
- Go: minimax-m3, glm-5.2, qwen3.6-plus, qwen3.7-max
Suspected root cause
OpenCode backend does not correctly handle reasoning_content echoing for DeepSeek V4 tool calls (and possibly MiMo), causing 400 errors that the client displays as "Internal server error".
Expected behavior
Either fix backend handling for these models, or update models.json to mark tool_call: false for affected models until fixed.

### Plugins

opencode-sessions, opencode-context-cache, magic-context

### OpenCode version

1.17.18

### Steps to reproduce

_No response_

### Screenshot and/or share link

_No response_

### Operating System

Windows 11

### Terminal

wezterm,Windows

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.

  3. frangcisneros commented on Sep 22, 2026

    @frangcisneros

    Reproduced the same 500 with mimo-v2.6-flash-free (Zen), specifically when the Read tool returns a PDF:

    Steps

    1. Session on opencode/mimo-v2.6-flash-free (OpenCode Zen)
    2. Read any PDF (tried a 14-page / 365 KB PDF)
    3. Stream fails immediately: AI_APICallError: Internal server error, retries forever (retrying attempt #3...), session unusable until undo/interrupt

    Log (~/.local/share/opencode/log/opencode.log):

    level=ERROR message="stream error" providerID=opencode modelID=mimo-v2.6-flash-free error.error="AI_APICallError: Internal server error"
    

    (repeats on every retry, both agent=plan and agent=build)

    Not a metadata issue: models.dev already declares PDF support for this model:

    "opencode": { "mimo-v2.6-flash-free": { "modalities": { "input": ["text","image","audio","video","pdf"], "output": ["text"] } } }

    So opencode happily forwards the PDF, and the Zen backend returns 500 on the request — same symptom as #34840 but different failure mode (that one was a client-side "does not support pdf" refusal).

    Workarounds that work client-side:

    • pdftoppm -png the pages, then Read the PNG — images are accepted fine, only the PDF document part triggers the 500
    • Extract text with PyMuPDF (fitz) via bash

    Affects only PDF attachments; plain text/image pastes on the same model work fine.

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