A team runs nightly production dbt jobs and wants to use state-based selection in CI to test only what has changed. After setting up the workflow, they realize that the CI job is selecting every model in the project instead of just modified ones. Which of the following is the MOST likely root cause?
- A. The CI environment is using a different dbt version than production, causing all node hashes to differ
- B. The
--deferflag was not included alongside--select state:modified+ - C. The
--stateflag is pointing to a directory that does not contain a validmanifest.jsonfrom a previous run✓ Correct - D. The
manifest.jsonfile was generated withdbt compileinstead ofdbt run, making it incompatible with state comparison
Explanation
State comparison requires a baseline manifest.json in the directory specified by --state. If that directory is empty or contains a stale/missing manifest, dbt cannot compare state and defaults to selecting all models. A dbt version mismatch can cause hash differences but typically surfaces as mismatches rather than full selection. --defer is separate from state selection and its absence does not cause all models to be selected. dbt compile does produce a valid manifest.json that can be used for state comparison — the artifact format is the same.