⚔️
409
Conflict
!
?

Example HTTP Response

HTTP Response
HTTP/1.1 409 Conflict
Content-Type: application/json

{"error": "Resource already exists"}
Common Causes
  • Editing outdated version of resource
  • Username already taken
  • Conflicting concurrent updates
Technical Details

What does this mean?

Clash of the titans! What you're trying to do doesn't match up with what's already there. Like double-booking a meeting room.

Technical Definition

The request conflicts with the current state of the server.

RFC Says

"The 409 (Conflict) status code 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."

Plain English:

409 means 'I can't do what you asked because it conflicts with the current state of the resource.' For example, trying to create a user with an email that already exists, or updating a resource that has been modified by someone else since you last read it.

Common Misinterpretation

Don't overuse 409 for all validation errors - use 400 or 422 for basic validation failures. Reserve 409 for genuine state conflicts, especially in scenarios involving optimistic locking, duplicate resources, or version conflicts.

Code Snippets

Ready-to-use code for returning this HTTP status in your application:

Node.js
// Express.js
app.get('/example', (req, res) => {
  res.status(409).json({
    error: 'Conflict',
    message: 'Your error message here'
  });
});

// Native HTTP
const http = require('http');

http.createServer((req, res) => {
  res.writeHead(409, { 'Content-Type': 'application/json' });
  res.end(JSON.stringify({
    error: 'Conflict',
    message: 'Your error message here'
  }));
}).listen(3000);