Skip to content

bug: Unexpected role after cancelling bash use when using Mistral Small 4 #578

@MalcolmMielle

Description

@MalcolmMielle

Component

CLI

Summary

I am using a local Mistral Small 4 model running with llvm on a DGX spark.

If I cancel the use of a tool, for example a bash script, I have a "Unexpected role 'user' after role 'tool'" error. This is copy of an example output.

Run the unit test using the .venv virtual environment and unittest
bash: skipped
Skipped: User cancelled the operation.
Run the unit test using the .venv virtual environment and unittest
Error: API error from spark (model: mistralai/Mistral-Small-4-119B-2603-NVFP4): LLM backend error [spark]
  status: 400 Bad Request
  reason: Bad Request
  request_id: N/A
  endpoint: http://spark-5500.local:8000/v1/chat/completions
  model: mistralai/Mistral-Small-4-119B-2603-NVFP4
  provider_message: Unexpected role 'user' after role 'tool'
  body_excerpt: {"error":{"message":"Unexpected role 'user' after role 'tool'","type":"BadRequestError","param":null,"code":400}}
  payload_summary: {"model":"mistralai/Mistral-Small-4-119B-2603-NVFP4","message_count":5,"approx_chars":26815,"temperature":0.2,"has_tools":true,"tool_choice":"auto"}

Reproduction steps

  1. Add a local Mistral Small 4 model
  2. Ask to run any bash command
  3. Instead of approving say "No and say what to do..."
  4. Relaunch the same command
  5. See the crash

Versions / environment

vide 2.7.3 uv 0.11.1 Ubuntu 24.05

Logs & screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIRelated to CLIbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions