409 Conflict

HTTP response status code 409 Conflict is a client error that is returned by the server to indicate that the request can not be satisfied because the current state is incompatible with what is required. The response from the server may contain information in the message body that the client can use to resolve the conflict.

Usage

When the 409 Conflict error message is received, it means that the request is valid, but cannot be completed due to some kind of mismatch. For example, if the client is replying to a post that has since been deleted, then the target resource is no longer in a compatible state and the server may return this status.

The client is expected to examine the message body to determine how to resolve the conflict. In the case of replying to the deleted post, the client may opt to abandon the request. Alternatively, it can undelete the former thread or instead, create a new thread with the former text quoted. This action will be entirely the responsibility of the client, following any requirements or policies put in place by the server.

Note

Search engines like Google will not index a URL with 409 Conflict response status, and consequently, URLs that have been indexed in the past but are now returning this HTTP status code will be removed from the search results.

Example

In the example, the client attempts to tag an existing blog post with “ID = 111” with a “like”. The server responds to say that the post has been frozen and can no longer accept replies or tags.

Request

POST /blog/update?postid=111&flag=like HTTP/1.1
Host: www.example.re

Response

HTTP/1.1 409 Conflict
Content-Type: text/html
Content-Length: 288

<html>
  <head>
    <title>Blog Entry Frozen</title>
  </head>
  <body>
   <p>This post has been marked read-only. To post a reply or tag it, please change the status and try again.</p>
  </body>
</html>

Code references

.NET

HttpStatusCode.Conflict

Rust

http::StatusCode::CONFLICT

Rails

:conflict

Go

http.StatusConflict

Symfony

Response::HTTP_CONFLICT

Python3.5+

http.HTTPStatus.CONFLICT

Java

java.net.HttpURLConnection.HTTP_CONFLICT

Apache HttpComponents Core

org.apache.hc.core5.http.HttpStatus.SC_CONFLICT

Angular

@angular/common/http/HttpStatusCode.Conflict

Takeaway

The 409 Conflict status code is a client error that the server sends to indicate that the resource is not in a state that is compatible with the request. The response may contain information sufficient to rectify the problem and allow the request to be resubmitted.

See also

Last updated: August 2, 2023