Mistral Provider: All tool execution fails with HTTP 400 (streaming generation)
Environment
- OS: Windows 11
- Obsidian Version: 1.12.7
- Nexus Version: v5.6.8
- Provider: Mistral (API key via La Plateforme)
- Model: Mistral Large Latest
- Node.js: v18+
Summary
Simple chat with Mistral works correctly. However, every tool execution (storageManager.list, file read, etc.) fails with HTTP 400. This makes vault access completely non-functional with the Mistral provider.
Steps to Reproduce
- Install Nexus v5.6.8 in Obsidian (Windows)
- Configure Mistral as provider with valid API key
- Select "Mistral Large Latest" as model
- Verify simple chat works (e.g. "What is 2+2?" → responds correctly ✅)
- Set up a workspace with vault root or subfolder
- Ask: "List all files in my vault" or "Read file XYZ.md"
- Tool execution fails with HTTP 400
Expected Behavior
Nexus should call Mistral's tool/function-calling API in the correct format and successfully execute vault operations (list, read, write).
Actual Behavior
Every tool call returns:
❌ Tool execution failed: streaming generation failed with HTTP 400
Console Errors
[MistralAdapter] Streaming error: ProviderHttpError: streaming generation failed with HTTP 400
at IncomingMessage.eval (plugin:nexus:7696:25)
at IncomingMessage.emit (node:events:531:35)
at endReadableNT (node:internal/streams/readable:1698:12)
at process.processTicksAndRejections (node:internal/process/task_queues:89:21)
Streaming tool execution error: Object
What Works vs. What Doesn't
| Feature |
Status |
| Simple chat (no tools) |
✅ Works |
| Model detection & listing |
✅ Works |
| Workspace context loading |
✅ Works |
| Provider connection / API key |
✅ Works |
| Any tool execution (list, read, write) |
❌ HTTP 400 |
Probable Root Cause
Based on cross-project research, Mistral's API has strict validation requirements for tool-calling that differ from Anthropic/OpenAI:
1. Tool Call ID Format
Mistral requires tool call IDs to be exactly 9 alphanumeric characters (a-z, A-Z, 0-9). Other providers accept longer or differently formatted IDs. If Nexus generates IDs in a different format (e.g. timestamp-based), Mistral rejects with HTTP 400.
2. Extra Fields in Tool Definitions
Mistral strictly rejects any non-standard fields in tool function definitions (e.g. requires_confirmation, external_execution). OpenAI and Anthropic silently ignore these. The MistralAdapter may need to strip Nexus-internal parameters before sending.
3. Tool Schema Restrictions
Mistral may reject oneOf, allOf, anyOf at the top level of tool input schemas. This was previously an issue with Claude Code as well (Nexus issue #6, now closed).
4. Message Role Ordering
Mistral rejects "user" role messages immediately after "tool" role messages. The conversation must include an "assistant" message between tool results and user messages.
Suggested Fix
The MistralAdapter in ProviderHttpClient likely needs:
- Tool call ID sanitization — generate 9-char alphanumeric IDs for Mistral
- Tool schema cleanup — strip non-standard fields before API call
- Message role validation — ensure correct role ordering per Mistral's requirements
Additional Context
- Prior issue (fixed in v5.6.8): Earlier BRAT versions had a CORS error where
node:https was dynamically imported, blocked by Obsidian's Electron environment. Resolved in v5.6.8 via ProviderHttpClient.
- Mistral's function calling docs: https://docs.mistral.ai/capabilities/function_calling/
- This likely affects all Mistral models, not just Mistral Large.
Workaround
Currently none for tool-calling. Simple chat without vault access works as expected.
Mistral Provider: All tool execution fails with HTTP 400 (streaming generation)
Environment
Summary
Simple chat with Mistral works correctly. However, every tool execution (storageManager.list, file read, etc.) fails with HTTP 400. This makes vault access completely non-functional with the Mistral provider.
Steps to Reproduce
Expected Behavior
Nexus should call Mistral's tool/function-calling API in the correct format and successfully execute vault operations (list, read, write).
Actual Behavior
Every tool call returns:
Console Errors
What Works vs. What Doesn't
Probable Root Cause
Based on cross-project research, Mistral's API has strict validation requirements for tool-calling that differ from Anthropic/OpenAI:
1. Tool Call ID Format
Mistral requires tool call IDs to be exactly 9 alphanumeric characters (a-z, A-Z, 0-9). Other providers accept longer or differently formatted IDs. If Nexus generates IDs in a different format (e.g. timestamp-based), Mistral rejects with HTTP 400.
2. Extra Fields in Tool Definitions
Mistral strictly rejects any non-standard fields in tool function definitions (e.g.
requires_confirmation,external_execution). OpenAI and Anthropic silently ignore these. TheMistralAdaptermay need to strip Nexus-internal parameters before sending.3. Tool Schema Restrictions
Mistral may reject
oneOf,allOf,anyOfat the top level of tool input schemas. This was previously an issue with Claude Code as well (Nexus issue #6, now closed).4. Message Role Ordering
Mistral rejects
"user"role messages immediately after"tool"role messages. The conversation must include an"assistant"message between tool results and user messages.Suggested Fix
The
MistralAdapterinProviderHttpClientlikely needs:Additional Context
node:httpswas dynamically imported, blocked by Obsidian's Electron environment. Resolved in v5.6.8 viaProviderHttpClient.Workaround
Currently none for tool-calling. Simple chat without vault access works as expected.