-
Notifications
You must be signed in to change notification settings - Fork 286
Description
Is this a new bug in dbt-core?
- I believe this is a new bug in dbt-core
- I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
Description
When dbt retries a BigQuery job creation (e.g. due to a timeout or transient network spike), BigQuery may return a 409 Conflict response, indicating the job was already registered. dbt currently treats this as a fatal error and fails, instead of recognizing that the job was successfully submitted and continuing normally.
The root cause is not the timeout itself — subsequent runs complete without issues, suggesting this is an edge case where the job confirmation did not return to dbt in time. The real problem is that dbt's retry logic does not handle 409 gracefully.
Actual Behavior
dbt raises an error on 409 Conflict, causing the run (and any orchestration flow, e.g. Prefect) to fail.
Expected Behavior
When dbt retries a job and receives 409 Conflict from BigQuery, it should recognize that the job already exists and treat it as a successful submission — then continue polling for the result as normal.
Steps To Reproduce
- Run a dbt model against BigQuery
- Simulate a transient delay (network spike, VM slowdown) that causes the job confirmation to not return within
job_creation_timeout_seconds - dbt retries with the same job ID
- BigQuery returns
409 Conflict - dbt fails instead of continuing with the existing job
Relevant log output
ValueError: Failures detected during invocation of dbt command 'test--selectpath:models/xxx/xxx':
Test relationships_context_arrival_map_site_id__site_id__ref_context_all_sites_ errored with message: "Database Error in test relationships_xxxxx_ (models/xxx/xxx/xxx.yaml)
409 POST https://bigquery.googleapis.com/xxxx: Already Exists: Job xxx-xxx:US.xxxx-xxxx-xxxx-xxxx-xxxxEnvironment
- OS: Debian 12
- Python: 3.12
- dbt: 1.10.3Which database adapter are you using with dbt?
bigquery
Additional Context
No response