Skip to content

gpt-oss tool calling broken after recent update - parser error during response generation #493

Description

@liampierc3

Bug Description

Tool calling with gpt-oss-20b fails during response generation with parsing error. The model successfully executes tool calls, but crashes when trying to generate a response with the results.

Error Message

Failed to regenerate message
Failed to parse tool call: Expected "<|message|>", but got "to=function" at index 89.

Environment

  • LM Studio Version: [Updated on Dec 12, 2024 - latest version]
  • Model: mlx-community/gpt-oss-20b-MXFP4-Q8
  • Platform: macOS (Apple Silicon)
  • MCP Servers Enabled:
    • @modelcontextprotocol/server-filesystem
    • @modelcontextprotocol/server-brave-search

Steps to Reproduce

  1. Load gpt-oss-20b model with MCP tools enabled
  2. Ask a question that triggers search tools (e.g., "Search my memory for X")
  3. Observe: Tools execute successfully multiple times
  4. Observe: Model attempts to generate response
  5. Error occurs: Parser crashes with the error above
  6. No output is returned to user

Expected Behavior

The model should successfully generate a response using the tool results, as it did before the recent LM Studio update.

Actual Behavior

  • Tools execute successfully ✓
  • Model begins response generation ✓
  • Parser encounters gpt-oss's native tool call format ✗
  • Parser expects <|message|> at position 89 but finds to=function instead ✗
  • Generation crashes, no output returned ✗

Technical Details

gpt-oss uses this chat template format for tool calls:
<|start|>assistant to=functions.TOOL_NAME<|channel|>commentary json<|message|>{"args": "..."}<|call|>

The new LM Studio parser appears to expect <|message|> earlier in the sequence, causing it to fail when it encounters to=function at index 89.

Evidence of the issue

  • This worked correctly before the December 12, 2024 update
  • The same setup works perfectly with Qwen3-VL-8B-Instruct-MLX-8bit model
  • The gpt-oss chat template hasn't changed - it's defined in the model's tokenizer_config.json
  • Only LM Studio's parser behavior has changed

Workaround

Using Qwen3-VL-8B-Instruct-MLX-8bit instead of gpt-oss works correctly with identical MCP server configuration.

Additional Context

gpt-oss has a unique chat template that uses special tokens like <|channel|>, <|message|>, and to= syntax for tool routing. The model expects its native format, but the new LM Studio parser appears to have broken compatibility with this format.

Metadata

Metadata

Assignees

No one assigned

    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