Skip to content

[BUG] Code mode does not work with devstral2 123b 2512 (NVIDIA NIM provider)Β #10540

@Hullabalo

Description

@Hullabalo

Problem (one or two sentences)

Expected roo to use tools without error (without blocking error).

Context (who is affected and when)

happens when giving a task to devstral2 123b 2512 model, using Nvidia NIM provider

Reproduction steps

Using devstral2 123b 2512 with Nvidia NIM provider

  • ask for a basic coding task in Code mode (same problem occurs when starting in Ask mode)
    -> model returns a first assistant message (e.g. "To create a basic Python code that writes "hi, buddy" 10 times in the console, I can write a simple script for you. Let me proceed with writing the code.")
    -> tool is used correctly (file written or edited)
    -> then, get an error message :
    OpenAI completion error: 400 Unexpected role 'user' after role 'tool' Unexpected role 'user' after role 'tool'

Expected result

model must returns a message or use another tool

Actual result

returns the same error message repeatedly

Variations tried (optional)

starting the same task in Ask mode, there is this added error message after roo switch to Code mode (and then this is the same behavior, like when starting in Code mode)

"I will switch to "πŸ’» Code" mode to write the Python code for you."

then :

Date/time: 2026-01-08T08:58:24.686Z
Extension version: 3.38.3
Provider: openai
Model: mistralai/devstral-2-123b-instruct-2512

The model provided text/reasoning but did not call any of the required tools. This usually indicates the model misunderstood the task or is having difficulty determining which tool to use. The model has been automatically prompted to retry with proper tool usage.

App Version

3.38.3

API Provider (optional)

OpenAI Compatible

Model Used (optional)

mistralai/devstral-2-123b-instruct-2512

Roo Code Task Links (optional)

No response

Relevant logs or errors (optional)

{
  "error": {
    "timestamp": "2026-01-08T08:49:47.510Z",
    "version": "3.38.3",
    "provider": "openai",
    "model": "mistralai/devstral-2-123b-instruct-2512",
    "details": "400\nOpenAI completion error: 400 Unexpected role 'user' after role 'tool' Unexpected role 'user' after role 'tool'"
  },
  "history": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "<task>\ncreate a basic python code that write 10 times 'hi, buddy' in console\n</task>"
        },
        {
          "type": "text",
          "text": "<environment_details>\n# VSCode Visible Files\nhello_world.py\n\n# VSCode Open Tabs\nhello_world.py\n\n# Current Time\nCurrent time in ISO 8601 UTC format: 2026-01-08T08:45:27.836Z\nUser time zone: Europe/Paris, UTC+1:00\n\n# Current Cost\n$0.00\n\n# Current Mode\n<slug>code</slug>\n<name>πŸ’» Code</name>\n<model>mistralai/devstral-2-123b-instruct-2512</model>\n<tool_format>native</tool_format>\n\n\n# Current Workspace Directory (/home/seb/Desktop/TEST) Files\nhello_world.py\nYou have not created a todo list yet. Create one with `update_todo_list` if your task is complicated or involves multiple steps.\n</environment_details>"
        }
      ],
      "ts": 1767861927851
    },
    {
      "role": "assistant",
      "content": [
        {
          "type": "text",
          "text": "I'll create a basic Python script that writes \"hi, buddy\" 10 times to the console. Let me write this code to the `hello_world.py` file."
        }
      ],
      "ts": 1767861930979
    },
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "[ERROR] You did not use a tool in your previous response! Please retry with a tool use.\n\n# Reminder: Instructions for Tool Use\n\nTools are invoked using the platform's native tool calling mechanism. Each tool requires specific parameters as defined in the tool descriptions. Refer to the tool definitions provided in your system instructions for the correct parameter structure and usage examples.\n\nAlways ensure you provide all required parameters for the tool you wish to use.\n\n# Next Steps\n\nIf you have completed the user's task, use the attempt_completion tool.\nIf you require additional information from the user, use the ask_followup_question tool.\nOtherwise, if you have not completed the task and do not need additional information, then proceed with the next step of the task.\n(This is an automated message, so do not respond to it conversationally.)"
        },
        {
          "type": "text",
          "text": "<environment_details>\n# VSCode Visible Files\nhello_world.py\n\n# VSCode Open Tabs\nhello_world.py\n\n# Current Time\nCurrent time in ISO 8601 UTC format: 2026-01-08T08:45:31.207Z\nUser time zone: Europe/Paris, UTC+1:00\n\n# Current Cost\n$0.00\n\n# Current Mode\n<slug>code</slug>\n<name>πŸ’» Code</name>\n<model>mistralai/devstral-2-123b-instruct-2512</model>\n<tool_format>native</tool_format>\nYou have not created a todo list yet. Create one with `update_todo_list` if your task is complicated or involves multiple steps.\n</environment_details>"
        }
      ],
      "ts": 1767861931210
    },
    {
      "role": "assistant",
      "content": [
        {
          "type": "tool_use",
          "id": "Sm5LHOyfs",
          "name": "write_to_file",
          "input": {
            "path": "hello_world.py",
            "content": "for _ in range(10):\n    print('hi, buddy')"
          }
        }
      ],
      "ts": 1767861933933
    },
    {
      "role": "user",
      "content": [
        {
          "type": "tool_result",
          "tool_use_id": "Sm5LHOyfs",
          "content": "{\"path\":\"hello_world.py\",\"operation\":\"modified\",\"notice\":\"You do not need to re-read the file, as you have seen all changes Proceed with the task using these changes as the new baseline.\"}"
        },
        {
          "type": "text",
          "text": "<environment_details>\n# VSCode Visible Files\nhello_world.py\n\n# VSCode Open Tabs\nhello_world.py\n\n# Current Time\nCurrent time in ISO 8601 UTC format: 2026-01-08T08:45:35.509Z\nUser time zone: Europe/Paris, UTC+1:00\n\n# Current Cost\n$0.00\n\n# Current Mode\n<slug>code</slug>\n<name>πŸ’» Code</name>\n<model>mistralai/devstral-2-123b-instruct-2512</model>\n<tool_format>native</tool_format>\nYou have not created a todo list yet. Create one with `update_todo_list` if your task is complicated or involves multiple steps.\n</environment_details>"
        }
      ],
      "ts": 1767861935513
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue/PR - TriageNew issue. Needs quick review to confirm validity and assign labels.bugSomething isn't working

    Type

    No type

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions