HTTP 409 Conflict indicates the request conflicts with the current state of the target resource. This is commonly used for: concurrent update conflicts (optimistic locking), unique constraint violations (duplicate email on registration), state machine violations (trying to publish an already-published article), and version conflicts in collaborative editing. The response body should explain the conflict and ideally how to resolve it.
Response includes the status code, standard headers (including Content-Type), and a small diagnostic JSON body describing the request and returned status.
Simulator URL (copy in the app after load — not a normal link):
https://httpstatus.com/api/status/409
Example request:
curl -i "https://httpstatus.com/api/status/409"The request could not be processed because of conflict in the request.
On this code, Inspector focuses on semantics, headers, and correctness warnings that commonly affect clients and caches.
HTTP 409 Conflict has specific technical implications for API design, caching, and client behavior. Understanding the precise semantics helps distinguish it from similar status codes and implement correct error handling. The response should include a descriptive body following a consistent error schema (like RFC 7807 Problem Details) so clients can programmatically handle the error.
// Handle 409 Conflict in Express
app.use((err, req, res, next) => {
if (err.status === 409) {
return res.status(409).json({
type: 'https://api.example.com/errors/conflict',
title: 'Conflict',
status: 409,
detail: err.message
});
}
next(err);
});from fastapi import HTTPException
# Raise 409 Conflict
raise HTTPException(
status_code=409,
detail={
'type': 'conflict',
'message': 'Descriptive error for 409 Conflict'
}
)// Spring Boot 409 Conflict handling
@ExceptionHandler(CustomConflictException.class)
public ResponseEntity<ErrorResponse> handleConflict(
CustomConflictException ex) {
return ResponseEntity.status(409)
.body(new ErrorResponse("Conflict", ex.getMessage()));
}// Return 409 Conflict
func errorHandler(w http.ResponseWriter, message string) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(409)
json.NewEncoder(w).Encode(map[string]any{
"status": 409,
"error": "Conflict",
"message": message,
})
}