fix: show actionable error when Ollama fails to parse tool calls (#11870)

* fix: show actionable error when Ollama fails to parse tool calls

When Ollama models (e.g. gpt-oss:20b) produce malformed tool call
output, Ollama returns "error parsing tool call" which previously
surfaced as an opaque "Unknown error".

Add pattern matching in analyzeError() to detect this specific error
and show a helpful message explaining the issue is transient, that the
user can resubmit, and that enabling "Only use system message tools"
in Settings > Experimental avoids Ollama's native tool call parser.

Fixes #11783, #11063, #10954, #10897, #10711, #10221, #9433

* fix: refine Ollama tool call error copy and matching

Tighten string match to "error parsing ollama response: error: error
parsing tool call" to avoid false positives. Soften settings suggestion
to "Enabling ... may reduce these errors".

* fix: match on Ollama's error string directly
This commit is contained in:
Dallin Romney 2026-03-25 22:09:11 -07:00 • committed by GitHub
parent 9396142fb0
commit 393c92509f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -149,6 +149,15 @@ export function analyzeError(
'No API key was sent with the request. Add "apiKey" to your model config.';
}
// Ollama tool call parsing failure (transient model output issue)
if (errorText.includes("error parsing tool call")) {
customErrorMessage =
"This model produced an invalid tool call that Ollama could not parse. " +
"This is a known transient issue — you can resubmit your message to try again. " +
'Enabling "Only use system message tools" in Settings > Experimental ' +
"may reduce these errors by avoiding Ollama's native tool call parser.";
}
// 402 Insufficient Balance
if (statusCode === 402 || errorText.includes("insufficient balance")) {
const providerLabel = providerName || "your provider";