Skip to content

Commit 393c925

Browse files
authored
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
1 parent 9396142 commit 393c925

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gui/src/util/errorAnalysis.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,15 @@ export function analyzeError(
149149
'No API key was sent with the request. Add "apiKey" to your model config.';
150150
}
151151

152+
// Ollama tool call parsing failure (transient model output issue)
153+
if (errorText.includes("error parsing tool call")) {
154+
customErrorMessage =
155+
"This model produced an invalid tool call that Ollama could not parse. " +
156+
"This is a known transient issue — you can resubmit your message to try again. " +
157+
'Enabling "Only use system message tools" in Settings > Experimental ' +
158+
"may reduce these errors by avoiding Ollama's native tool call parser.";
159+
}
160+
152161
// 402 Insufficient Balance
153162
if (statusCode === 402 || errorText.includes("insufficient balance")) {
154163
const providerLabel = providerName || "your provider";

0 commit comments

Comments
 (0)