dbt "Compilation Error ... depends on a node named ... which was not found" in CI
dbt parsed your project and built the DAG, but a ref() or source() points to a node that is not in the graph. dbt raises a Compilation Error naming the model and the missing dependency.
What this error means
dbt compile or dbt run fails with "Compilation Error in model X ... depends on a node named 'Y' which was not found". The referenced model name is misspelled, missing, or excluded by selection.
Compilation Error in model orders (models/marts/orders.sql)
depends on a node named 'stg_payments' which was not foundCommon causes
A typo or renamed model in ref()
The string in ref('stg_payments') does not match any model file name, often after a rename that missed a reference.
The referenced model is not in the built project
The model lives in a package or path not installed/compiled in CI, or a --select filter excluded it while a dependent stayed in.
How to fix it
Correct the ref to a real model name
- Find the model name dbt says is missing.
- Confirm a
.sqlfile or source defines exactly that name. - Fix the
ref()/source()string, then re-rundbt compile.
-- the referenced model must exist as models/staging/stg_payments.sql
select * from {{ ref('stg_payments') }}Install packages and avoid partial selection
Run dbt deps so package models are present, and build a consistent selection so a model is not referenced without its dependency.
dbt deps
dbt compileHow to prevent it
- Run
dbt depsbefore compile so package nodes exist. - Update every
ref()when renaming a model. - Use
--select +modelto include upstream dependencies in selective builds.