Sometimes the provider answers with garbage: an empty body, HTML from a proxy, or truncated JSON. This error family covers it.

- EmptyResponseBodyError: the provider returned no body at all.
- InvalidResponseDataError: the body did not match the expected shape.
- JSONParseError: the body was not valid JSON. Also appears as the cause inside NoObjectGeneratedError.

import { InvalidResponseDataError } from '@ai-sdk/provider';

What to know:
1. If these appear intermittently, suspect the network path first: a proxy or WAF returning HTML error pages looks exactly like InvalidResponseDataError. Log the raw body (carefully, it may be large).
2. If they appear consistently for one provider, your baseURL is probably wrong: you are talking to a non-API endpoint (a docs page, a gateway path typo) that returns HTML.
3. Truncated JSON at high maxOutputTokens with long outputs can surface as JSONParseError on object mode. Raising nothing fixes it; the fix is retry or a smaller schema.
4. DownloadError is the sibling for binary/media downloads. Same debugging approach: check the URL and the middleboxes.
5. These are distinct from APICallError: the HTTP status was fine, the payload was not. A 200 with an HTML body is the classic.
6. When filing a provider bug, capture the failing raw body bytes and the request id. Without them the provider cannot reproduce it.