<#6985 feat(flyte-sdk): Add non-recoverable error ...
# flyte-github
a
#6985 feat(flyte-sdk): Add non-recoverable error type to skip retries Issue created by pingsutw Summary Currently, Flyte retries a task on any error up to the configured
retries
count. There is no way to signal that a particular failure is non-recoverable and should not be retried at all, even if retries remain. Motivation Some errors are definitively terminal — for example: • Invalid input data that will never change between retries • A downstream dependency that is permanently unavailable • A business-logic assertion failure where retrying would produce the same result In these cases, retrying wastes resources and increases overall workflow latency. Users need a first-class way to raise a non-recoverable error so the task (and optionally the workflow) fails immediately without consuming retry attempts. Proposed Solution Introduce a
FlyteNonRecoverableException
(or similar) in
flyte
that, when raised inside a task, instructs the Flyte engine to mark the task as permanently failed and skip all remaining retries. from flyte.exceptions import FlyteNonRecoverableException @task(retries=3) def my_task(x: int) -> str: if x < 0: # This will NOT be retried even though retries=3 raise FlyteNonRecoverableException("Negative input is invalid and will never succeed.") ... Expected behaviour: • Any other exception → normal retry logic applies (up to
retries
count). •
FlyteNonRecoverableException
→ task fails immediately, retries are not consumed. Implementation Notes • Add
FlyteNonRecoverableException
to
flyte/exceptions/
. • Propagate the non-recoverable signal through the task execution metadata (e.g., a flag in
TaskExecutionMetadata
or error kind). • The
flytepropeller
execution engine should detect this flag and transition the node directly to a terminal failed state, bypassing the retry handler. • Update documentation and add unit tests. Acceptance Criteria •
FlyteNonRecoverableException
is available in
flyte
. • When raised, the task fails immediately without retrying. • All other exceptions continue to use the existing retry behaviour. • Documentation is updated. • Tests are added. flyteorg/flyte