Problem
#42610 removed the executor's redaction logic, but it also removed the raw-body fallback. When a provider's error body has no error.message or top-level message, users now see only Provider request failed with HTTP N, even though the provider explained the problem.
Live examples that currently show only the generic message: Mistral {"detail":"Invalid API Key"}, NVIDIA {"title":"Gone","detail":"The model ... has reached its end of life ..."}, xAI {"code":"invalid-argument","error":"Incorrect API key provided..."}, Cloudflare {"errors":[{"message":"Authentication error"}]}.
Fix
In packages/ai/src/route/executor.ts, without a recognized message, show the status and the raw body, capped at 2,000 characters:
Provider request failed with HTTP 401: {"detail":"Invalid API Key"}
- The body is not redacted or otherwise rewritten, only truncated.
- HTML error pages from gateways and proxies, and empty bodies, keep the generic message, as in v1.
reason.body still holds the complete body, and classification and retries are unchanged.
Recognizing more provider message layouts and fixing classification gaps will come in follow-up PRs.
Tests
- New tests cover an unrecognized JSON body, truncation, and HTML pages.
- Two existing expectations change: plain-text and blank-message bodies now include the body.
bun test in packages/ai and bun run check pass.