409
HTTPERRORNotable4xx Client ErrorHIGH confidence

Conflict

Production Risk

Low. This is an expected error in systems that support concurrent editing or have unique constraints. A well-designed client should be able to handle it gracefully.

What this means

Indicates that the request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and resubmit the request.

Why it happens
  1. 1A user tries to create a resource that already exists (e.g., a username that is taken).
  2. 2A user tries to update a resource, but their version is outdated (an edit conflict).
  3. 3The requested operation cannot be performed because of the resource's current state (e.g., trying to delete a non-empty directory).
How to reproduce

Two users attempt to edit the same wiki page at the same time, and the second user's save attempt is rejected to prevent overwriting the first user's changes.

trigger — this will error
trigger — this will error
PUT /api/documents/123 HTTP/1.1
Host: example.com
If-Match: "old-etag"
Content-Type: application/json

{ "content": "new content" }

expected output

HTTP/1.1 409 Conflict

Fix 1

Implement Version Control

WHEN Developing an API for editable resources.

Implement Version Control
Use ETags and the 'If-Match' header to detect edit conflicts and reject outdated updates.

Why this works

Server-Side Logic

Fix 2

Fetch the Latest Version

WHEN You are the client and receive a 409.

Fetch the Latest Version
Re-fetch the resource, apply your changes to the latest version, and try submitting again.

Why this works

Client-Side Logic

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All HTTP errors