Home / dbt / Projects and profiles
dbt: Compilation Error: dbt found two models with the name
dbt found two models with the name "orders".Two resources of the same type share a name, so ref() would be ambiguous. Model names must be unique across the whole project, including subfolders, and across installed packages for some resource types.
Common causes
- Two .sql files with the same name live in different folders, for example staging/orders.sql and marts/orders.sql.How to confirm: The message lists both unique ids and their file paths.
- A copied or renamed file left the old version behind.How to confirm: One of the two paths is a backup or an old copy.
How to fix it
Rename one of the files (model names come from file names), or delete the stale copy. Use alias in config() if the database table name must stay the same.
Where the message comes from
exceptions.pyindbt-labs/dbt-coreatv1.12.6- Message checked in dbt-core 1.12.6
Message template in the source: dbt found two %s with the name "%s".