Retry Guidelines
When API calls or async operations fail, following proper retry patterns ensures your integration is resilient without risking account safety.
When to Retry
| Error Type | Retry? | Strategy |
|---|---|---|
429 Too Many Requests | ✅ Yes | Retry after some time |
500 Internal Server Error | ✅ Yes | Exponential backoff |
PROXY_ERROR | ✅ Yes | Retry after checking proxy status |
SESSION_EXPIRED | ✅ Yes | Re-authenticate, then retry |
WRONG_PASSWORD | ❌ No | Fix credentials |
ACCOUNT_RESTRICTED | ❌ No | Account needs manual attention |
CANT_RESEND_YET | ⏳ Wait | Cannot re-invite the same person within two weeks |
QUEUE_TIMEOUT_THRESHOLD_EXCEEDED | ✅ Yes | Re-submit the request; reduce queue pressure by spreading workload |
Exponential Backoff
For transient errors, use exponential backoff with jitter:
async function retryWithBackoff(fn, maxRetries = 5) {
for (let attempt = 0; attempt < maxRetries; attempt++) {
try {
return await fn();
} catch (error) {
if (attempt === maxRetries - 1) throw error;
// Don't retry client errors (except 429)
if (error.status >= 400 && error.status < 500 && error.status !== 429) {
throw error;
}
const delay = Math.min(1000 * Math.pow(2, attempt), 30000);
const jitter = delay * (0.5 + Math.random() * 0.5);
await new Promise((resolve) => setTimeout(resolve, jitter));
}
}
}
Rate Limit Handling
When you receive a 429 response:
- Stop sending requests for that account immediately
- Queue any pending requests
- Resume after the wait period
warning
Never retry immediately after a 429. Doing so may compound the rate limit issue and could trigger LinkedIn safety flags.