idempotency_key_reused
The message text is shown in the example below.
⚠️
Preview — this feature is being built; the design below is the spec. In the public error catalog, but today only the private mobile conversation routes return it.
| HTTP status | 409 |
type | conflict_error |
| Retry? | No, not unchanged |
| Status | Not live / provisional |
| Extra fields | none |
When it happens
The same Idempotency-Key was sent within 24 hours with a different body.
Example
{
"error": {
"type": "conflict_error",
"code": "idempotency_key_reused",
"message": "This Idempotency-Key was already used with a different request body. Use a new key for a new request.",
"param": null,
"request_id": "req_6f1c2a9e0b7d4c3a8e5f1b2d"
}
}How to fix it
- Generate a new key for every logically new operation; reuse a key only when retrying the identical request.
Detect it in code
err = resp.json().get("error", {})
if resp.status_code == 409 and err.get("code") == "idempotency_key_reused":
log.warning("%s (%s)", err["message"], err["request_id"]) # fix the request; do not retry unchangedRelated
Was this page helpful?