> 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-platform/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-for-pipelines.md).

# Rollback pipelines

Pipeline rollback is a type of [failure strategy](/harness-platform/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-on-stages-and-steps.md) that allows you to roll back the entire pipeline upon stage or step failure.

{% hint style="info" %}
Pipeline Rollback is available by default for CD steps and stages. For all other stages, pipeline rollback is behind the feature flag `CDS_ALLOW_EXPRESSION_RESOLUTION_PIPELINE_ROLLBACK`. Please contact [Harness Support](mailto:support@harness.io) to enable this feature flag.
{% endhint %}

### Configure a rollback failure strategy <a href="#configure-a-rollback-failure-strategy" id="configure-a-rollback-failure-strategy"></a>

1. In your pipeline, go to the step or stage where you want the rollback strategy to be triggered if that step or stage fails.
2. Go to the **Advanced** settings for the selected step or stage.
3. under **Failure Strategy**, locate **On failure of type**, and select the [error type](/harness-platform/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-on-stages-and-steps.md#error-types) that you want to trigger the rollback.
4. Under **Perform Action**, select **Rollback Pipeline**.

Here's an example of the YAML for a pipeline rollback failure strategy that triggers on any error.

```yaml
failureStrategies:
  - onFailure:
      errors:
         - AllErrors
      action:
         type: PipelineRollback
```

During pipeline execution, if the failure event occurs that triggers the rollback failure strategy, all steps and stages are rolled back accordingly.

{% hint style="warning" %}
If a pipeline uses [pipeline chaining](/harness-platform/use-harness-platform/pipelines/pipeline-chaining.md) (where one or more stages are actually other pipelines), rolling back the parent pipeline **does not** roll back the child pipeline, because the child pipeline is considered a separate pipeline execution. In such cases, only the deployment stages of the parent pipeline roll back.
{% endhint %}
