idempotency_conflict means your organization already used this Idempotency-Key for a run with a different body. Read this page if you retry runs, or if you build keys from ids that can repeat.
What happened
Route:POST /v1/runs.
An Idempotency-Key belongs to one request for the life of your organization; keys never expire. When a key arrives again, OpenType compares the new body with the one stored for that key:
“The same body” means the same input and the same contract:
Changing any value in the left column under an old key gets this error. Changing only a value in the right column does not: you get the stored run back, as it first ran. The request was refused before a new run existed, and the original run is unchanged.
How to fix
- Retrying the same request: send exactly the original body with the original key. You get the stored run back.
- Sending a new request: use a new key. A changed prompt, schema or question set is a new request.
- Keys that repeat by accident: if two different requests can derive the same key, add the part that differs to the key, such as the question-set version:
ticket-4822-triage-v2.
A content-derived key repeats for the same body. When a run fails with a 5xx that tells you to retry with a new key, add an attempt counter to the key, such as
-a2. Otherwise the replay returns the stored pending run with 202.Example
Related
- Idempotency - replays, conflicts and key lifetimes in full.
- Error handling - when a retry reuses the key and when it needs a new one.
- idempotency_key_required - the header is missing.
- Problem codes - every code, its status, and whether a retry can help.