Skip to content

409 Conflict explained

By the ProxyOnly team · 25 Nov 2026 · 5 min read

A 409 means your request conflicts with the resource's current state. The duplicate case, the lost update case, and how ETag and If-Match prevent both.

A 409 Conflict means the server understood your request, would normally allow it, and refused because it clashes with the current state of the thing you are changing.

RFC 9110 describes it as a conflict with the current state of the target resource, and adds that conflicts are most likely to occur in response to a PUT request. It also says the server should generate content that includes enough information for a user to recognise the source of the conflict, which in practice means a 409 with an empty body is a bug.

The important part is that a 409 is about state, not about syntax or permission. The request is well formed. You are allowed. It just cannot be true right now.

The two situations that produce almost every 409

Something already exists

You POST a new user with an email address that is taken, or create a project with a slug already in use. A unique constraint in the database rejects the insert and the API turns that into a 409.

Some APIs use 422 Unprocessable Content for this instead, and both are defensible. The rough convention: 409 when the clash is with another resource that exists, 422 when the value itself is unacceptable in isolation.

Two people changed the same thing

This is the interesting one, and the reason 409 exists as a separate code. It is called the lost update problem.

Two editors open the same document. Both read version 1. A saves. B saves. Without any protection, B's save silently overwrites A's work, and nobody is told. The data is not corrupt, it is just quietly wrong, which is worse.

A working demonstration

The fix is optimistic concurrency control. The server gives every version of a resource an ETag. A client that wants to change the resource sends the ETag it read, in an If-Match header. The server compares. If they differ, somebody else got there first, and the answer is 409.

The server side is about ten lines:

def do_PUT(self):
    want = self.headers.get("If-Match")
    if want is None:
        self._send(428, b"If-Match required")
    elif want != DOC["etag"]:
        self._send(409, b"document changed since you read it")
    else:
        length = int(self.headers.get("Content-Length", 0))
        DOC["body"] = self.rfile.read(length).decode()
        DOC["etag"] = '"v2"'
        self._send(204, b"", [("ETag", DOC["etag"])])

Two editors then race for it:

a = requests.get(U); b = requests.get(U)
r1 = requests.put(U, data="A's edit", headers={"If-Match": a.headers["ETag"]})
r2 = requests.put(U, data="B's edit", headers={"If-Match": b.headers["ETag"]})

We ran it, and it printed:

editor A read etag "v1" | editor B read etag "v1"
A saves  -> 204 "v2"
B saves  -> 409 | document changed since you read it
stored   -> A's edit

A's work survived. B was told, clearly, instead of destroying it. That is the whole point of the code.

Note the 428 Precondition Required when If-Match is missing. RFC 6585 defines it for exactly this: the server wants the request to be conditional, so that clients cannot modify state blind. It is optional, and it is a good habit on any endpoint where two clients can collide.

Why not just lock the row?

Optimistic concurrency is called optimistic because it assumes collisions are rare and only checks at write time. The alternative, pessimistic locking, takes a lock when the first client starts editing and makes everyone else wait.

Pessimistic locking suits short transactions inside one database. It suits web APIs badly, because the gap between read and write is a human one. Somebody opens a form, goes to lunch, and comes back. A lock held across that window blocks everyone, and a lock released on a timeout gives you the lost update problem again with extra steps.

This is why the web settled on ETags. The check happens at the moment of writing, costs nothing while nobody collides, and produces a clear 409 when somebody does. You have seen the same pattern outside HTTP: a version control push rejected because the remote moved on, and a database that aborts a serialisable transaction rather than let two writes interleave. Same idea, same reasoning.

How 409 differs from its neighbours

  • 400 Bad Request: the server could not parse the request. See 400 Bad Request.
  • 403 Forbidden: you are not allowed, and state has nothing to do with it.
  • 409 Conflict: valid, allowed, and inconsistent with what exists now.
  • 412 Precondition Failed: a conditional header such as If-Match failed. Closely related, and some APIs use it where others use 409.
  • 422 Unprocessable Content: the values are wrong on their own terms.
  • 428 Precondition Required: you must send a conditional header, and did not.

On 409 against 412: both are correct for a failed If-Match, and real APIs disagree. GitHub returns 409 for a merge conflict and for a stale ref on some endpoints. If you are designing an API, pick one and document it.

If you are building the API

Say what conflicted. "Conflict" alone is useless. This is the minimum worth sending:

{"error": "stale_version", "your_version": "v1", "current_version": "v3"}

Give clients a way to resolve it rather than only a way to fail. A link to the current state, or the current ETag in the response, lets a client re-read, merge and retry without a second round trip to discover what happened.

Use 409 for genuine state conflicts, not as a general-purpose rejection. Once a code means several unrelated things, clients cannot handle it automatically.

Consider idempotency keys for creation. If a client POSTs twice because a connection dropped, an idempotency key lets you return the original resource rather than a 409 for a duplicate the client did not intend to make.

If a client or scraper gets a 409

Do not retry the identical request. Unlike a 429 or a 503, the state will not resolve itself while you wait, and an unchanged retry will conflict again.

The correct loop is read, merge, resend:

  1. GET the resource again and read the new ETag.
  2. Decide what your change means on top of the new state. This step is yours, not the server's.
  3. PUT again with the new If-Match value.
  4. Cap the attempts, because a resource that conflicts five times in a row is being written by something faster than you.

On a duplicate-creation 409, check for the existing resource and use it, rather than generating a new identifier and trying again. A 409 on create is usually the API telling you that your work is already done.

Rotating your IP address will not help. A 409 is about data you sent and data that exists, and both are the same from any address.

Try it yourself

Create an account, add funds from US$1 and order a proxy in the country you need.

Keep reading