From 393c92509f26a4027b9c002ecf2fd18d2cae95d4 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 25 Mar 2026 22:09:11 -0700 Subject: [PATCH] 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 --- gui/src/util/errorAnalysis.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gui/src/util/errorAnalysis.ts b/gui/src/util/errorAnalysis.ts index b04356490..f866b90ec 100644 --- a/gui/src/util/errorAnalysis.ts +++ b/gui/src/util/errorAnalysis.ts @@ -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";