SDK client crashes with a raw JSON parse error on non-JSON (HTML) API responses
Describe the bug
When a proxy / gateway / CDN returns an HTTP 200 with an HTML body (an error or interstitial page) instead of JSON, the generated SDK client crashes with a raw JSON Parse error: Unrecognized token '<'.
parseAs falls back to "json" whenever Content-Type is missing or unrecognized, so a non-JSON body reaches JSON.parse unguarded on the success path (the error-response path is already guarded). Surfaces to users as chat sendMessageError with an unactionable parse error (~11 machines / 7d in telemetry).
Expected behavior
An actionable error naming the received content-type and HTTP status (e.g. "Expected a JSON response but received text/html (HTTP 200) — usually a proxy or gateway error page"), instead of a raw parse crash.
To Reproduce
- Point the CLI's backend at an endpoint returning
200+ an HTML body (with a JSON or missing content-type). - Send a chat message.
- Observe
SyntaxError: JSON Parse error: Unrecognized token '<'instead of a useful error.
Resolved in v0.11.0.