dbt Compilation Error: model depends on a node not found (ref) in CI
dbt built the dependency graph and a ref() pointed at a model name it cannot find. Either the referenced model file is missing, renamed, or misspelled, or it lives in a package that was not installed.
What this error means
dbt compile, run, or build stops with "Compilation Error: Model 'X' depends on a node named 'Y' which was not found".
dbt
Compilation Error
Model 'model.my_project.orders' (models/marts/orders.sql) depends on a node
named 'stg_orders' which was not foundCommon causes
The referenced model name is misspelled or renamed
A ref('stg_orders') points at a name that no model produces because the file was renamed or the string is wrong.
The referenced model comes from an uninstalled package
The model lives in a dbt package that dbt deps did not install, so the node is absent from the graph.
How to fix it
Correct the ref or add the missing model
- Confirm a model file produces the exact name used in
ref(). - Fix the string or restore the renamed model.
- Run
dbt compileto confirm the graph resolves.
Terminal
dbt compile --select ordersInstall packages that provide referenced models
If the model comes from a package, run dbt deps before compiling so its nodes exist.
Terminal
dbt deps
dbt compileHow to prevent it
- Run
dbt depsbefore compile so package models are present. - Use
ref()names that exactly match model file outputs. - Run
dbt compilein CI on every change to catch broken refs early.
Related guides
dbt "Compilation Error: found a cycle" circular ref in CIFix dbt "Compilation Error: Found a cycle" in CI - two or more models ref() each other, creating a circular d…
dbt "Compilation Error: macro not found" in CIFix dbt "Compilation Error: macro X not found" in CI - a model or config calls a macro that is not defined in…
dbt "Runtime Error: relation does not exist" in CIFix dbt "Database Error ... relation X does not exist" in CI - a model or test queries a table or view that w…