Skip to content

409 Conflict

The request conflicts with the current state of the resource, such as saving a version that someone else already changed.

What 409 Conflict means

409 says the request is reasonable but cannot be applied right now because of the resource's state. The client should be able to resolve the conflict and send it again.

Common uses are edit conflicts, duplicates (a username that is already taken) and deleting something other records depend on. 412 is the header-based version of the edit conflict case.

Common causes

  • Two users or processes editing the same record, where the second save is based on stale data.
  • Creating something that already exists, such as a duplicate email or ID.
  • Deleting a resource that other data still references.

How to fix 409 Conflict

  1. Fetch the latest version, reapply or merge your changes, and retry.
  2. Read the response body to see which field or version caused the conflict.
  3. For APIs, send If-Match with the ETag so stale updates are caught reliably with 412.

Example response

HTTP/1.1 409 Conflict
Content-Type: text/plain; charset=utf-8

409 Conflict

How to check for a 409 response

cURL

# Print only the status code
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/

JavaScript (Node.js)

const res = await fetch("https://example.com/");
if (res.status === 409) {
  console.log(res.status, res.statusText);
}

Python

import requests

res = requests.get("https://example.com/")
if res.status_code == 409:
    print(res.status_code, res.reason)

Go

res, err := http.Get("https://example.com/")
if err != nil {
	log.Fatal(err)
}
defer res.Body.Close()
if res.StatusCode == 409 {
	fmt.Println(res.Status)
}

Specification

409 Conflict is defined in RFC 9110, section 15.5.10.

  • 412

    Precondition Failed

    A condition in the request headers, such as If-Match or If-Unmodified-Since, was false, so the server did not apply the request.

  • 422

    Unprocessable Content

    The server understood the request and its format, but the data inside failed validation, like a missing field or bad email.

  • 428

    Precondition Required

    The server requires a conditional request, such as one with If-Match, to stop clients from overwriting each other's changes.

← all 63 HTTP status codes

Type to search posts, tools and projects.

Keyboard shortcuts

Search+Kor/
Go to homegthenh
Go to bloggthenb
Go to projectsgthenp
Go to timelinegthent
Show this help?
Close search or helpesc