dbt-labs / dbt-labs/dbt

[CT-3217] [Bug] Multiple calls of `dbt-retry` fail with exit code 2

Open
#8,848 8 comments 0 reactions 0 assignees View on GitHub
engine:v1 retry type:bug
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-core?

- [X] I believe this is a new bug in dbt-core
- [X] I have searched the existing issues, and I could not find an existing issue for this bug

### Current Behavior

The command `dbt-retry` can only be used once, but not multiple times after another. When I used again, it throws an error with exit code 2.

![image](https://github.com/dbt-labs/dbt-core/assets/67712864/f07515e2-25b6-4d1f-b211-c3345e1f5d5d)

### Expected Behavior

In a job, I have some modes which sometimes - not always - fail (due to a stale issue, hard to tackle with Spark, see https://github.com/dbt-labs/dbt-spark/issues/395).

To fix, I just want to run twice a retry so that I only get a job running error when a model did not build after running it 3 times.

Strangely, the `dbt-retry` just breaks when I call it a second time. In my opinion, dbt should somehow write a "completed" information to the `target` folder, so that a second `dbt retry` does not crash.

### Steps To Reproduce

1. run `dbt run` with a model that fails
2. fix the model and run `dbt retry`
3. run `dbt retry` again. You will get a broken `dbt retry` with exit code 2.

### Relevant log output

```shell
05:59:17 Running with dbt=1.6.2
05:59:18 Registered adapter: databricks=1.6.4
05:59:19 Encountered an error:
Runtime Error
Could not find previous run in 'target' target directory
```

### Environment

```markdown
- OS: Databricks Runtime 12.2 LTS
- Python: 3.9.5
- dbt: 1.6.2
- dbt-databricks: 1.6.4
```

### Which database adapter are you using with dbt?

other (mention it in "Additional Context")

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.