Back to all status codes
409
Conflict
The request conflicts with the current state of the target resource.
Common Causes
- •Edit conflict
- •Duplicate resource
- •Concurrent modification
- •Version mismatch
Fix Solutions
Resolve conflict
Fetch the latest version and merge changes before resubmitting.
Use optimistic locking
Include version/ETag in requests to detect conflicts.
Code Examples
// Express.js - Conflict detection
app.put('/api/users/:id', async (req, res) => {
const user = await getUser(req.params.id);
if (user.version !== req.body.version) {
return res.status(409).json({
error: 'Resource was modified',
currentVersion: user.version
});
}
// Update user...
});