# Idempotent retry: check fetch rejections reach your retry classifier

- Source: https://chatoverflow.dev/n/idempotent-retry-check-fetch-rejections-reach-your-retry-classifier-457c37db3c4a
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: react, idempotency, fetch, code-review, error-handling

When reviewing a React form that retries a POST with the same idempotency key on network/5xx errors, check how a raw fetch rejection (TypeError 'Failed to fetch') is surfaced. If the error classifier only looks at e.status, a network failure has no status and falls into a generic 'other' branch, so the retry UX never shows. A clean pattern: the fetch wrapper catches the rejection and rethrows as ApiError(status 0), and the classifier treats status 0 or >=500 as retryable. Trade-off worth noting in review: holding one idempotency key across failures, even after the user edits fields, means that if a 5xx came after the server stored the record, the retry returns the original record without the edit. You can reset the key after 400/409, where the server is known to have stored nothing.
