> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-ai/use-harness-platform/pipelines/failure-handling/fast-fail.md).

# Fail Fast Pipeline

Enable fail fast behavior to immediately fail pipelines when any step or stage in a parallel group fails.

In traditional deployments, Harness waits for all steps or stages to complete before determining pipeline status. This can be inefficient when an early failure is enough to trigger rollback.

Harness supports fail fast behavior, which immediately fails the pipeline and triggers the configured failure strategy when any step or stage in a parallel group fails.

***

## What you will learn from this topic

* Understand [fail fast behavior](#fail-fast-behavior) and when to use it.
* How to [configure fail fast](#configure-fail-fast) in your pipeline failure strategy.
* How [fail fast works with matrix iterations](#fail-fast-with-matrix-iterations) and parallel execution behavior.

***

## Before you begin

* **Feature flag required:** This feature requires the `PIPE_FAIL_ALL_FAILURE_STRATEGY` feature flag. Contact [Harness Support](mailto:support@harness.io) to enable this feature flag.
* **Pipeline permissions:** You must have Edit permissions on pipelines to configure failure strategies. For more information, refer to [Manage roles](/harness-ai/use-harness-platform/platform-access-control/add-manage-roles.md).

{% hint style="info" %}
**Supported step types**

This feature is only supported for deployment steps, such as Helm deploy step, Amazon Auto Scaling Group (ASG) Deploy steps, Kubernetes deploy, and GitOps Sync steps.

It is not supported for other step types including Verify steps, Approval steps, and other non-deployment steps.
{% endhint %}

***

## Fail fast behavior

When fail fast is enabled, if any step or stage in a parallel group fails, the pipeline immediately:

* Fails without waiting for the remaining steps to complete.
* Triggers the configured failure strategy, such as pipeline rollback.

This is particularly useful in scenarios where early failures should halt the entire rollout.

***

## Configure fail fast

{% hint style="info" %}
**YAML configuration only**

Fail fast is currently configured through YAML only. There is no UI option to enable this feature. You must edit your pipeline YAML directly.
{% endhint %}

To enable fail fast behavior, add `failAll: true` to the failure strategy at stage level.

The following YAML example shows a failure strategy with fail fast enabled:

```yaml
failureStrategies:
  - onFailure:
      errors:
        - AllErrors
      action:
        type: PipelineRollback
        spec:
          failAll: true
```

***

## Fail fast with matrix iterations

`failAll: true` also applies when the failing stage uses a [matrix strategy](/harness-ai/use-harness-platform/pipelines/looping-strategies/looping-strategies-matrix-repeat-and-parallelism.md#matrix-strategies). When one matrix iteration fails, Harness triggers the configured failure strategy for the stage, for example rolling back through **PipelineRollback**.

`failAll: true` does not cancel matrix iterations that are already running. Iterations that have started continue to completion; only iterations that haven't started yet are skipped. This matches the general parallel-execution behavior described in [Failure strategy support for multiservice, multi-infrastructure, and matrix deployment](https://developer.harness.io/docs/continuous-delivery/x-platform-cd-features/failure-strategy-service-env#failure-strategy-support-for-multiservice-multi-infrastructure-and-matrix-deployment): already-started deployments in a parallel group cannot be stopped, even when a failure occurs elsewhere in the group.

Once every iteration reaches a terminal state, the configured failure strategy runs once for the stage, for example a single **PipelineRollback** that rolls back all matrix iterations together.

***

## Next steps

* [Define a failure strategy on stages and steps](/harness-ai/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-on-stages-and-steps.md): Learn about other failure strategy actions available for stages and steps.
* [Rollback pipelines](/harness-ai/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-for-pipelines.md): Learn more about pipeline rollback failure strategies.

{% @harness-feedback/feedback module="harness-ai" pagePath="harness-ai/use-harness-platform/pipelines/failure-handling/fast-fail" %}
