OpenRouter tool-incapable model surfaces misleading Responses API invalid_union error
Summary
A BYO OpenRouter user whose selected model has no tool-capable endpoint hits a confusing openrouter Responses API error: … invalid_union instead of OpenRouter's real, actionable error — and the app wastes a guaranteed-to-fail /v1/responses round-trip on every such request.
Problem
What happens: When an OpenRouter model is selected whose providers don't support tool use (e.g. nvidia/nemotron-3.5-content-safety:free), OpenHuman sends chat/completions with agent tools. OpenRouter replies:
404 Not Found: {"error":{"message":"No endpoints found that support tool use. Try disabling \"spawn_async_subagent\". To learn more about provider routing, visit https://openrouter.ai/docs/guides/routing/provider-s…"}}
OpenRouter is a builtin cloud provider built with supports_responses_fallback = true (the AuthStyle::Bearer arm in provider/factory.rs constructs via OpenAiCompatibleProvider::new). So the 404 triggers the /v1/responses fallback. But OpenRouter's /v1/responses rejects OpenHuman's ResponsesRequest body schema:
400: {"error":{"code":"invalid_prompt","message":"Invalid Responses API request"},"metadata":{"raw":"[{"code":"invalid_union", …}]"}}
Impact:
- The user sees a misleading Responses API / invalid_union error that hides the real cause (their model can't do tool use).
- A guaranteed-fail second request is issued on every occurrence.
- Sentry TAURI-RUST-863 (~3.1k events / 19 users) is pure noise from the doomed fallback.
Repro:
- Configure an OpenRouter BYO key.
- Select a model whose providers don't support tool calling (e.g. a content-safety / moderation model).
- Run any agent turn that sends tools.
- Observe
openrouter Responses API error … invalid_unioninstead of the OpenRouter404 No endpoints found….
Version / platform: desktop, observed across 0.57.11–0.57.53 (macOS; provider-agnostic).
Solution
OpenRouter does not implement the OpenAI Responses API (it rejects the request body with invalid_union), so the /v1/responses fallback is always wrong for it. Build the OpenRouter provider with new_no_responses_fallback (keyed via is_openrouter_provider), exactly as Ollama / LM Studio were keyed in TAURI-RUST-59Y. The genuine, actionable OpenRouter 404 then surfaces to the user instead of the misleading Responses error, and the wasted round-trip is removed.
Acceptance criteria
- [ ] Repro gone — OpenRouter no longer issues a
/v1/responsesfallback on achat/completions404; user sees the real OpenRouter error. - [ ] Regression safety — unit test asserting OpenRouter does not fall back to
/responseson 404 (mirror of the 59Y Ollama/LM Studio guards); generic-cloud fallback test stays green. - [ ] Diff coverage ≥ 80%.
Related
- Sentry:
TAURI-RUST-863(~3.1k ev / 19 users) — the doomed/responsesfallback noise this fixes. - Sentry:
TAURI-RUST-ADC(~5.9k ev / 10 users) — the same root cause surfacing as the genuine404 No endpoints found that support tool use. This is preventable user-state (an agent that needs tools was routed to a non-tool-capable model). It should get a real prevention fix (tool-capability gating / model validation), not a classifier demotion. Tracked here as follow-up so it is not buried. - Precedent:
TAURI-RUST-59Y(Ollama / LM Studio — same guaranteed-404/responsesfallback class).
Fixed by #4009 (provider-capability gate) rather than the openrouter-only PR #4010 (closed as superseded). #4009 disables the doomed /v1/responses fallback for OpenRouter along with every other chat-completions-only builtin. The TAURI-RUST-ADC prevention follow-up (tool-capability gating, not demotion) is captured in #4009.