406 Not Acceptable
Content negotiation failed: the client asked (via Accept, Accept-Language, or Accept-Encoding) for a representation the server cannot provide.
The server cannot produce a response matching the Accept headers sent in the request.
What HTTP 406 Not Acceptable Means
The server cannot produce a response matching the Accept headers sent in the request.
Content negotiation failed: the client asked (via Accept, Accept-Language, or Accept-Encoding) for a representation the server cannot provide.
Common Causes
- Accept header requests an unsupported media type
- Accept-Language asks for an unavailable locale
- Overly strict content negotiation on the server
- A proxy or security tool injecting a bad Accept header
How to Fix It (For Visitors)
- Reload the page
- Try a different browser or disable extensions that alter headers
How to Fix It (For Developers/Admins)
- Send a supported Accept header (e.g. application/json)
- Make content negotiation more permissive or fall back to a default type
- Return the closest available representation instead of 406
Returning a 406 Not Acceptable (Code Examples)
If you build APIs or web apps, here is how to send an HTTP 406 response and how to test for it:
Node.js (Express)
app.get('/resource', (req, res) => {
res.status(406).json({ error: 'Not Acceptable' });
});
Python (Flask)
@app.route('/resource')
def resource():
return jsonify(error='Not Acceptable'), 406
PHP
<?php
http_response_code(406);
header('Content-Type: application/json');
echo json_encode(['error' => 'Not Acceptable']);
Check the status with curl
curl -I https://example.com/resource
# Look for: HTTP/1.1 406 Not Acceptable
Frequently Asked Questions
What does HTTP 406 Not Acceptable mean?
Content negotiation failed: the client asked (via Accept, Accept-Language, or Accept-Encoding) for a representation the server cannot provide. In short: The server cannot produce a response matching the Accept headers sent in the request.
Is 406 Not Acceptable a client or server error?
406 is a 4xx client-error code, so the request itself needs to change. The server is running normally and is rejecting the request as it was sent by the browser, app, or API client.
How do I fix a 406 Not Acceptable error?
Send a supported Accept header (e.g. application/json). Make content negotiation more permissive or fall back to a default type. Return the closest available representation instead of 406.
Official Specification
The 406 Not Acceptable status code is defined in RFC 9110 Section 15.5.7.