#16328: fix: add 'does not support tools' to format error patterns for failover
agents
stale
size: XS
Cluster:
Ollama Model Enhancements
This PR adds the error string "does not support tools" to the format error patterns. This is commonly returned by Ollama (400 Bad Request) when a model does not support tool use. Recognizing this error allows OpenClaw to correctly trigger a model fallback instead of stopping with an unhandled error.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds the `"does not support tools"` string to `ERROR_PATTERNS.format` in `src/agents/pi-embedded-helpers/errors.ts`, enabling OpenClaw to recognize Ollama's 400 Bad Request error when a model lacks tool support and trigger model failover instead of surfacing an unhandled error.
- The new pattern is a single string addition to the existing `format` error patterns array, consistent with how other format errors (e.g., `"invalid request format"`) are already handled.
- `matchesErrorPatterns` lowercases input before comparison, so the match is case-insensitive.
- No test cases were added for the new pattern — consider adding a test in `pi-embedded-helpers.iscloudcodeassistformaterror.e2e.test.ts` and `pi-embedded-helpers.classifyfailoverreason.e2e.test.ts` to cover the Ollama-specific error string.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge — it's a minimal, additive change to an error pattern list with no risk of breaking existing behavior.
- The change adds a single string to an existing error pattern array, following the exact same convention as all other entries. The matching logic in matchesErrorPatterns is well-tested and case-insensitive. The new pattern correctly enables failover for Ollama models that don't support tools. No logical, security, or syntax issues.
- No files require special attention.
<sub>Last reviewed commit: e143b4b</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#16098: fix: omit tools param for models without tool support, surface erro...
by claw-sylphx · 2026-02-14
82.1%
#6464: fix: trigger model failover on malformed tool-call JSON
by ai-fanatic · 2026-02-01
75.5%
#17231: fix(failover): recognize model_cooldown as rate-limit for fallback
by thebtf · 2026-02-15
74.7%
#16529: fix(fallback): treat OpenRouter routing errors as failover-eligible
by zirubak · 2026-02-14
74.6%
#5115: fix: guard against undefined model.name in Ollama discovery (#5062)
by TheWildHustle · 2026-01-31
74.1%
#21033: fix(failover): classify connection errors as timeout for model fail...
by zerone0x · 2026-02-19
72.6%
#20534: fix: handle malformed tool call JSON parse errors gracefully
by echoVic · 2026-02-19
72.5%
#3828: fix(providers): add "field required" to failover error patterns
by ai-fanatic · 2026-01-29
72.2%
#11877: feat(ollama): auto-detect vision capability via /api/show
by Nina-VanKhan · 2026-02-08
72.0%
#4782: fix: Auto-discover Ollama models without requiring explicit API key
by spiceoogway · 2026-01-30
72.0%