HTTP

HTTP 406 Not Acceptable vs 409 Conflict

Both HTTP 406 (Not Acceptable) and 409 (Conflict) belong to the 4xx Client Error category. 406 indicates that the server cannot produce a response matching the Accept headers sent by the client. Meanwhile, 409 means that the request conflicts with the current state of the server. Often due to concurrent modification or business rule violations.

Description

The server cannot produce a response matching the Accept headers sent by the client.

When You See It

When requesting a content type the server doesn't support (e.g., Accept: application/xml when only JSON is available).

How to Fix

Adjust the Accept header to a format the server supports.

Description

The request conflicts with the current state of the server. Often due to concurrent modification or business rule violations.

When You See It

When trying to create a resource that already exists, or updating a resource that was modified by another request.

How to Fix

Refresh the resource state, resolve conflicts, and retry. Use ETags for optimistic concurrency.

Key Differences

1.

HTTP 406: The server cannot produce a response matching the Accept headers sent by the client.

2.

HTTP 409: The request conflicts with the current state of the server. Often due to concurrent modification or business rule violations.

3.

You encounter 406 when when requesting a content type the server doesn't support (e.g., Accept: application/xml when only JSON is available).

4.

You encounter 409 when when trying to create a resource that already exists, or updating a resource that was modified by another request.

When to Use Which

For 406 (Not Acceptable): Adjust the Accept header to a format the server supports. For 409 (Conflict): Refresh the resource state, resolve conflicts, and retry. Use ETags for optimistic concurrency.

Learn More