This rule requires that allDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/aurelienbobenrieth/gadget/llms.txt
Use this file to discover all available pages before exploring further.
api.enqueue calls explicitly specify the retries option. Gadget defaults to 6 retries with exponential backoff, which may cause unnecessary costs and delays for errors that are deterministic (will fail every time).
Rule Details
This rule checks allapi.enqueue calls and reports an error if the retries option is not explicitly set. The retries option can be:
- A number:
retries: 0orretries: 3 - An object:
retries: { retryCount: 5, backoffFactor: 2 }
Examples
Incorrect
Correct
Why This Matters
Gadget’s default retry behavior is 6 retries with exponential backoff. This is helpful for transient errors (network issues, temporary service outages), but problematic for deterministic errors that will fail every time (validation errors, missing data, etc.). Without explicit retries:- Deterministic errors will retry 6 times unnecessarily
- Each retry incurs billing costs
- Exponential backoff means failed jobs take a long time to fully fail
- Logs fill up with duplicate error messages
Example Impact
Recommended Settings
Choose based on your error type:- Deterministic errors (validation, business logic):
retries: 0 - Transient errors (API calls, external services):
retries: 3or higher - Critical jobs that must succeed: Use higher retry counts with appropriate backoff
This rule applies to all files, not just action files, since
api.enqueue can be called from anywhere in your codebase.When to Use
This rule is included in thestrict config. While not critical, it helps prevent unnecessary costs and makes retry behavior explicit and intentional.