**Possible inputs**: A single failure type, or an array of one or more failure types:
<!--
If you change any of the values below, make sure to update the `RETRY_WHEN_IN_DOCUMENTATION`
...
...
@@ -3415,7 +3397,34 @@ Possible values for `when` are:
-`scheduler_failure`: Retry if the scheduler failed to assign the job to a runner.
-`data_integrity_failure`: Retry if there is a structural integrity problem detected.
You can specify the number of [retry attempts for certain stages of job execution](../runners/configure_runners.md#job-stages-attempts) using variables.
**Example of `retry:when`** (single failure type):
```yaml
test:
script:rspec
retry:
max:2
when:runner_system_failure
```
If there is a failure other than a runner system failure, the job is not retried.
**Example of `retry:when`** (array of failure types):
```yaml
test:
script:rspec
retry:
max:2
when:
-runner_system_failure
-stuck_or_timeout_failure
```
**Related topics**:
You can specify the number of [retry attempts for certain stages of job execution](../runners/configure_runners.md#job-stages-attempts)