Visitar URL original
Pass a list of exceptions for task decorator for auto retry · Issue #650 · taskiq-python/taskiq · GitHub
Skip to content

Pass a list of exceptions for task decorator for auto retry #650

Description

@tallisbackatcoding

Is your feature request related to a problem?

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

Describe alternatives you've considered

No response

Which component would this affect?

Broker

Activity

  1. s3rius commented on Jul 22, 2026

    @s3rius
    Member

    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_exceptions argument, which you can use.

    Actually it might be a good idea to add types_of_exceptions to task decorator as additional types.

  2. tallisbackatcoding commented on Jul 23, 2026

    @tallisbackatcoding
    Author

    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

  3. spikeninja commented on Jul 24, 2026

    @spikeninja
    Contributor

    @tallisbackatcoding
    this feature will be added soon, we will tag you here when it's done

  4. spikeninja commented on Aug 27, 2026

    @spikeninja
    Contributor

    @tallisbackatcoding added in this PR
    wait for the new verison

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions