Roo Code: MiMo-V2.5 chat template crashes when system.content is an OpenAI content-part array
Hi Xiaomi MiMo team,
I found a compatibility issue when serving XiaomiMiMo/MiMo-V2.5 with the recommended SGLang image and using OpenAI-compatible clients such as Roo Code. I do believe I have the latest version of the templates as I only downloaded the model after that warning message.
The model works correctly when the system message content is a plain string, but crashes when system.content is provided as an OpenAI-style content-part array.
Environment:
Model: XiaomiMiMo/MiMo-V2.5
Serving image: lmsysorg/sglang:dev-mimo-v2.5
Backend: SGLang OpenAI-compatible /v1/chat/completions
Command includes:
--reasoning-parser mimo
--tool-call-parser mimo
--trust-remote-code
--attention-backend fa3
Minimal repro:
curl -s http://127.0.0.1:8000/v1/chat/completions
-H 'Content-Type: application/json'
-d '{
"model": "model_name",
"messages": [
{
"role": "system",
"content": [
{"type": "text", "text": "You are a helpful coding assistant."}
]
},
{
"role": "user",
"content": "Say hello in one sentence."
}
],
"max_tokens": 64
}'
Actual result:
500 Internal Server Error
TypeError: can only concatenate str (not "list") to str
Trace points to the HF chat template rendering path:
transformers/tokenization_utils_base.py -> apply_chat_template Expected result: The template should either accept OpenAI-style text content parts for system.content, or SGLang/model preprocessing should normalize: "content": [{"type": "text", "text": "You are a helpful coding assistant."}] to: "content": "You are a helpful coding assistant." before rendering the template. Notes: User messages with content parts work correctly. Temporary workaround that fixed it locally: Monkeypatch transformers.PreTrainedTokenizerBase.apply_chat_template to flatten only text-only system.content arrays into strings before calling the original method. The workaround avoids touching user multimodal/image messages. It would be useful if the official tokenizer_config.json chat template or recommended SGLang serving path handled this case directly. Excellent model, by the way, I have been very impressed by it, thank you for releasing it!
transformers/utils/chat_template_utils.py -> render_jinja_template
jinja2/environment.py -> compiled_template.render
, line 54
TypeError: can only concatenate str (not "list") to str
Basic OpenAI tools arrays also work correctly.
The failure appears specific to structured system.content.
This affects Roo Code because it sends the system prompt as OpenAI-style content parts.