Skip to content

MiniMax M3 rejects sessions with prior tool-call history #32611

Description

@megamen32

Bug Description

MiniMax M3 rejects an existing OpenCode session after switching the session from another model to opencode-go/minimax-m3.

The failure happens only in sessions that already contain tool-call/tool-result history. A fresh MiniMax M3 session works.

Provider error:

invalid params, tool call result does not follow tool call (2013)

Expected Behavior

Switching a tool-heavy existing session to MiniMax M3 should either work or send a provider-compatible transcript. Historical tool-call/tool-result context should not cause MiniMax to reject the request before generation starts.

Current Behavior

OpenCode sends the old tool transcript to opencode-go/minimax-m3; MiniMax validates the tool sequence strictly and returns HTTP 400.

Reproduction Steps

  1. Use an OpenCode session with prior tool use, for example reads/greps/shell calls.
  2. Continue the same session using opencode-go/minimax-m3.
  3. Send a normal user message.
  4. The request fails with HTTP 400 from MiniMax.

I verified that a fresh MiniMax M3 session succeeds with a simple prompt, so this is tied to prior tool history in the session.

Possible Solution

Flatten historical tool-call/tool-result parts to plain text for MiniMax before provider serialization. This keeps the transcript context while avoiding MiniMax strict tool-result sequencing validation. Current-turn tools can remain enabled.

Additional Info

Observed provider endpoint: https://opencode.ai/zen/go/v1/messages.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions