Skip to content

[BUG]: codestral, pixtral, mixtral skip Mistral tool call transform (has fix) #16636

Closed

Description

@tobwen

Description

When using codestral, pixtral, or mixtral via a custom @ai-sdk/openai-compatible endpoint, tool call IDs are not normalized to Mistral's required 9-character alphanumeric format, causing API errors. PR #2440 added this for @ai-sdk/mistral and devstral but missed these three.

Plugins

none

OpenCode version

v1.2.21, dev

Steps to reproduce

  1. Configure a custom provider in opencode.json using @ai-sdk/openai-compatible with a model ID containing codestral, pixtral, or mixtral
  2. Start a session and trigger a tool call
  3. Observe API error due to invalid tool call ID format

Screenshot and/or share link

No response

Operating System

Debian Linux (Trixie, 64-bit)

Terminal

PuTTY

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 8, 2026
  2. changed the title [-][BUG]: codestral, pixtral, mixtral skip Mistral tool call transform (follow-up)[/-] [+][BUG]: codestral, pixtral, mixtral skip Mistral tool call transform (has fix)[/+] on Mar 8, 2026
  3. assigned and unassigned on Apr 26, 2026
  4. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. fmflurry commented on May 7, 2026

    @fmflurry

    Using Mistral Medium 3.5, does the tool calls work for you ? Mine is corrupted and it can't properly call basic tools.

    • OpenCode: 1.14.40
    • Model: mistral/mistral-medium-2604
    • Provider: native mistral via @ai-sdk/mistral
    • Runtime where bug appears: OpenCode worker / harness session
    • Plugins enabled: @tarquinen/opencode-dcp@latest
    • Platform: macOS arm64

    Observed examples:

    write{"filePath":"...","content":"..."}
    task{"description":"...","prompt":"..."}
    read{"filePath":"..."}
    Those are rendered as normal assistant text/final content, so no tool executes. Session becomes unusable because the agent keeps “calling” tools in plain text.

    Image
  6. sttomm commented on May 13, 2026

    @sttomm

    I also ran into the same issue as @fmflurry. It happens very frequently to me. It simply responds the toolcall in a normal user message and then gets stuck, as the toolcall does not come back.

  7. fmflurry commented on May 13, 2026

    @fmflurry

    I also ran into the same issue as @fmflurry. It happens very frequently to me. It simply responds the toolcall in a normal user message and then gets stuck, as the toolcall does not come back.

    I found a solution. I updated the @ai-sdk/mistral and created a provider to override the default one.

  8. Crazyphil commented on Jul 6, 2026

    @Crazyphil

    @fmflurry How did you define the provider? I tried the same workaround, but I still get the same bug.

    This is my definition in openhab.jsonc:

    {
      // ...
      "provider": {
        "mistral": {
          "name": "Mistral (custom)",
          "npm": "@ai-sdk/mistral@4.0.5",
          "models": {
            "mistral-medium-3-5": {
              "name": "Mistral Medium 3.5",
              "variants": {
                "high": {
                  "reasoningEffort": "high"
                }
              }
            },
            "mistral-small-2603": {
              "name": "Mistral Small 4",
              "variants": {
                "high": {
                  "reasoningEffort": "high"
                }
              }
            }
          }
        }
      },
      // ...
    }
  9. fmflurry commented on Jul 6, 2026

    @fmflurry

    @fmflurry How did you define the provider? I tried the same workaround, but I still get the same bug.

    This is my definition in openhab.jsonc:

    {
      // ...
      "provider": {
        "mistral": {
          "name": "Mistral (custom)",
          "npm": "@ai-sdk/mistral@4.0.5",
          "models": {
            "mistral-medium-3-5": {
              "name": "Mistral Medium 3.5",
              "variants": {
                "high": {
                  "reasoningEffort": "high"
                }
              }
            },
            "mistral-small-2603": {
              "name": "Mistral Small 4",
              "variants": {
                "high": {
                  "reasoningEffort": "high"
                }
              }
            }
          }
        }
      },
      // ...
    }

    Take a look at the bottom of my config file : https://github.com/fmflurry/settings-opencode/blob/master/opencode.jsonc

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