# aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html'

- **ID:** `python/aiohttp-content-type-error`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Calling resp.json() on a response with a non-JSON content type.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.7 | active | — | — |
| 3.8 | active | — | — |
| 3.9 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   if resp.content_type == 'application/json': data = await resp.json() else: text = await resp.text()
   ```
2. **** (90% success)
   ```
   data = await resp.json(content_type=None)
   ```

## Dead Ends

- **** — It's a client-side parameter, not a server-side fix. (70% fail)
- **** — Works but bypasses aiohttp's built-in error handling. (20% fail)
