API calls implement retry logic with exponential backoff
Why it matters
Transient network failures — DNS blips, cloud provider hiccups, brief overloads — are normal in distributed systems. Without retry logic, a single dropped packet causes a user-visible failure on an operation that would succeed 200ms later. ISO 25010 reliability.recoverability requires the application to restore a defined performance level after failure; immediate hard failures with no retry violate that objective. Equally important: retrying non-idempotent POST requests without user confirmation risks duplicate charges, duplicate submissions, or duplicate order creation — a common and costly AI-coding defect.
Severity rationale
Medium because missing retry logic converts recoverable transient failures into permanent user-visible errors, and naive retry on non-idempotent calls risks duplicate transactions.
Remediation
Implement retry with exponential backoff and jitter. Only auto-retry idempotent requests (GET, safe PUT). For POST/DELETE, surface a retry button to the user instead.
// lib/retry.ts
export async function withRetry<T>(
fn: () => Promise<T>,
{ maxAttempts = 3, baseDelayMs = 200 } = {}
): Promise<T> {
for (let attempt = 0; attempt < maxAttempts; attempt++) {
try {
return await fn()
} catch (err) {
if (attempt === maxAttempts - 1) throw err
const delay = baseDelayMs * 2 ** attempt + Math.random() * baseDelayMs
await new Promise((r) => setTimeout(r, delay))
}
}
throw new Error('unreachable')
}
Jitter (the Math.random() term) prevents thundering-herd when multiple clients retry simultaneously after a shared outage.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Error Resilience Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-703 — Improper Check or Handling of Exceptional Conditions
- iso-25010:2011 · reliability.recoverability
Taxons
History
- 2026-04-18·v1.0.0·Initial import from error-resilience·automated