# InvalidResponseBodyError<!-- -->

Error raised when a response body cannot be parsed.

This occurs when the API returns a body that does not match its content type, for example a malformed JSON document. It is raised on a response the client already accepted, so it is not retried - a transfer that breaks mid-body surfaces as a transport error inside the retry loop instead. It subclasses `ValueError`, the error a failed JSON decode raises, so an `except ValueError` handler catches it too.

### Hierarchy

* [ApifyClientError](https://docs.apify.com/api/client/python/reference/class/ApifyClientError.md)
  * *InvalidResponseBodyError*

## Index[**](#Index)

### Methods

* [**\_\_init\_\_](https://docs.apify.com/api/client/python/reference/class/InvalidResponseBodyError.md#__init__)

## Methods<!-- -->[**](#Methods)

### [**](#__init__)\_\_init\_\_

* ****\_\_init\_\_**(response): None

- Initialize the error from an unparsable response.

  ***

  #### Parameters

  * ##### response: [HttpResponse](https://docs.apify.com/api/client/python/reference/class/HttpResponse.md)

    The HTTP response whose body could not be parsed.

  #### Returns None
