tool::http-status-detail
409 Conflict
The request conflicts with the current state of the server.
ステータスコード
409
名前
Conflict
カテゴリ
4xx詳細説明
HTTP 409 Conflictは、リクエストがサーバーの現在の状態と競合して処理できないことを示します。同じリソースを同時に変更したり、重複データを作成しようとしたり、バージョンが一致しない更新を試みた場合に発生します。REST APIの楽観的ロック(Optimistic Locking)実装でよく使用されます。
主な原因
- ▸既に存在するユーザー名やメールアドレスでアカウント作成を試みた場合
- ▸楽観的ロックの失敗(ETags不一致によるバージョン競合)
- ▸同時編集によるデータ競合の発生
- ▸親リソースなしに子リソースを作成しようとした場合
解決方法
- 1.競合しているリソースをまず取得して現在の状態を確認してください
- 2.ETags基準の楽観的ロックなら最新バージョンに更新してから再試行してください
- 3.重複キー競合の場合は既存データを更新する方向に変更してください
- 4.レスポンスボディで競合の具体的な原因を確認してください
関連HTTPヘッダー
Content-TypeETagレスポンス例
HTTP/1.1 409 Conflict
Content-Type: application/json
{"error":"conflict","message":"Username 'john_doe' already exists"}関連ステータスコード
400Bad RequestThe server could not understand the request due to invalid syntax.→401UnauthorizedAuthentication is required and has failed or not been provided.→402Payment RequiredReserved for future use; some services use it for payment walls.→403ForbiddenThe server refuses to fulfill the request (authenticated but unauthorized).→404Not FoundThe requested resource could not be found.→
ad · 300×250
// related tools