Skip to content

fix: multiple calls of dbt-retry fail with exit code 2#12627

Open
showyou wants to merge 3 commits intodbt-labs:mainfrom
showyou:fix-multiple-retry-error
Open

fix: multiple calls of dbt-retry fail with exit code 2#12627
showyou wants to merge 3 commits intodbt-labs:mainfrom
showyou:fix-multiple-retry-error

Conversation

@showyou
Copy link

@showyou showyou commented Mar 10, 2026

Resolves #8848

Problem

When calling dbt retry multiple times, if the previous run returned zero results and completed successfully, the next run resulted in an error.

The cause is as described in the issue, but to put it simply: when the count of results in the ExecutionResult class is 0, not self.previous_results evaluates to True in dbt/core/dbt/task/retry.py, leading to unexpected results.

self.previous_results = load_result_state(
    Path(config.project_root) / Path(state_path) / RUN_RESULTS_FILE_NAME
        )
if not self.previous_results:
    raise DbtRuntimeError(

Solution

if not self.previous_results:

have been changed to

if self.previous_results is none:

I also added test class about this issue.

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

@showyou showyou requested a review from a team as a code owner March 10, 2026 06:49
@cla-bot
Copy link

cla-bot bot commented Mar 10, 2026

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @showyou

@github-actions github-actions bot added the community This PR is from a community member label Mar 10, 2026
@showyou
Copy link
Author

showyou commented Mar 10, 2026

I have submitted the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community This PR is from a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant