[v2 Bug] `dbt retry` after `--fail-fast` re-runs the entire original selection instead of resuming from the failure
- Dominant language
- Rust
- Stars
- 13.8k
- Forks
- 2.6k
- Avg merge
- 21h 31m
- Merged PRs (30d)
- 56
Description
### Is this a new bug in dbt v2.x compared to the latest version of dbt 1.x?
- [x] I believe this is a new bug in dbt v2.x
- [x] I have searched the existing issues and could not find a duplicate
### Current Behavior
After a build that stopped early due to `--fail-fast`, `dbt retry` re-executes the **entire original selection** — including models that already succeeded — instead of resuming from the failure.
In dbt-core 1.x, `retry` after a fail-fast run resumes: it rebuilds the failed node and any nodes never reached, and skips models that already succeeded. On 2.0 it restarts the whole selection.
Example (node counts illustrate the discrepancy):
```
$ dbt@2 build -s "" --fail-fast --target dev
... Summary: N succeeded | 1 failed | M skipped/never-started
$ dbt@2 retry
... re-runs all N previously-succeeded models + the failed one,
rather than just the failed node + the M unreached nodes
```
This bug is found on `run`, `build` and `seed` commands
### Expected Behavior
`dbt retry` should resume the previous run, not restart it: rebuild the failed node and the nodes that were never reached, and **skip models that already succeeded** — matching dbt-core 1.x behavior.
### Steps To Reproduce
1. Run a build over a selection large enough that `--fail-fast` halts with some models already succeeded and others never started:
```bash
dbt@2 build -s "" --fail-fast --target dev
```
Note the summary counts, e.g. `N succeeded | 1 failed | M skipped`.
2. Fix the cause of the single failure.
3. Retry:
```bash
dbt@2 retry
```
4. Observe that retry rebuilds all N previously-succeeded models in addition to the failed node, rather than only the failed node + the M unreached nodes.
Reproduces on a large selection where fail-fast leaves a mix of succeeded / failed / never-started nodes.
### Relevant log output
```shell
Finished 'seed' with 21 errors for target 'local' [8.5s]
Processed: 1 hook | 64 seeds
Summary: 65 total | 20 success | 1 error | 44 no-op
```
followed by
```shell
dbt@2 retry
dbt-core 2.0.0-alpha.4
Retrying 64 failed nodes from previous seed command
...
```
shows rerunning the original `64 nodes / seeds`
### Environment
```markdown
- OS: macOS
- CPU: arm64
- dbt distribution and version: dbt-core 2.0.0-alpha.4
```
### Which database adapter are you using?
bigquery
### Is this a discrepancy vs. dbt 1.x?
- [x] Yes — this works in dbt 1.x but not in dbt v2.x
### Additional Context
Part of a cluster of `--fail-fast` / `retry` issues found while evaluating dbt 2.0:
- #14536 — `dbt retry` executes out-of-scope data tests (e.g. after `seed`/`run` that didn't run tests)
- #15560 — `--fail-fast` suppresses the error report on large selections
All three are in the retry / fail-fast area of the v2 engine.
Contributor guide
Assessment
This issue has not been assessed yet.