You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pass a list of exceptions for task decorator for auto retry #650
I am using taskiq for my project and wanted to have some of them to be retried on specific Exceptions like in celery with autoretry_for parameter.
Question is: why taskiq doesn't have that feature and what are the workarounds for that?
Describe the solution you'd like
I would love to see taskiq have that argument for individual tasks for auto retry
I know about types_of_exceptions but it is global for all tasks under that broker. I am more interested about having types of exceptions specific for individual tasks. Like task1 will retry for exception1, exception2 and task2 will retry for exception3 and exception4 and so on.
Activity
s3rius commentedon Jul 22, 2026
It does have this feature. Take a look at our retry middlewares.
https://taskiq-python.github.io/available-components/middlewares.html#simple-retry-middleware
SmartRetryMiddleware have
types_of_exceptionsargument, which you can use.Actually it might be a good idea to add
types_of_exceptionsto task decorator as additional types.tallisbackatcoding commentedon Jul 23, 2026
I know about types_of_exceptions but it is global for all tasks under that broker. I am more interested about having types of exceptions specific for individual tasks. Like task1 will retry for exception1, exception2 and task2 will retry for exception3 and exception4 and so on.
@task(autoretry_for=[Ex1, Ex2])
async def task1():
...
@task(autoretry_for=[Ex3, Ex4])
async def task2():
...
Something like that, customizable list for each task
spikeninja commentedon Jul 24, 2026
@tallisbackatcoding
this feature will be added soon, we will tag you here when it's done
spikeninja commentedon Aug 27, 2026
@tallisbackatcoding added in this PR
wait for the new verison