429 Too Many Requests response, Chappie automatically retries the request with exponential backoff so your app stays responsive without hammering the API. You can tune the retry count, delay bounds, and header behaviour — or disable backoff entirely — through ChappieRateLimitBackoffPolicy.
Default behaviour
The default policy (ChappieRateLimitBackoffPolicy.default) retries up to 2 times, starting with a 1-second delay, capped at 30 seconds, and always honours the Retry-After response header when the server includes one. After all retries are exhausted, Chappie throws ChappieClientError.usageLimitReached (if the response body carries usage-limit metadata) or a ChappieClientError.httpError(429, ...) otherwise.
Policy parameters
The maximum number of retry attempts after the first
429. Set to 0 to disable automatic retries entirely — equivalent to using .disabled. The SDK clamps negative values to 0.The initial wait in seconds before the first retry. Subsequent retries double this value up to
maximumDelay. The SDK clamps negative values to 0.The upper bound in seconds for the exponential delay. No retry waits longer than this value, even if the
Retry-After header requests a longer wait. The SDK clamps negative values to 0.When
true, Chappie reads the Retry-After response header and uses that value instead of the computed exponential delay, subject to maximumDelay. When false, Chappie always uses its own computed backoff and ignores the header.Customising backoff
Pass aChappieRateLimitBackoffPolicy to Chappie.client(rateLimitBackoff:) or embed it in a ChappieConfiguration:
Disabling backoff entirely
Use the.disabled static value to turn off all automatic retries. Chappie surfaces the 429 immediately as an error:
What does .disabled expand to?
What does .disabled expand to?
.disabled is a convenience static that sets maxRetries to 0:ChappieRateLimitBackoffPolicy(maxRetries: 0) directly.Handling exhausted retries
When Chappie runs out of retry attempts, it throws one of two errors depending on the response body:ChappieClientError.usageLimitReached(ChappieUsageLimit)— when the backend returns structured usage-limit metadata (plan type, reset time, usage percentages). Inspect the associatedChappieUsageLimitvalue to show a meaningful message.ChappieClientError.httpError(Int, String)— for bare429responses without usage-limit metadata.