dbt found two resources with the same name" duplicate model
Resolves dbt duplicate resource name errors by finding the two colliding files and either renaming one or scoping references with the package name. Use when dbt parse fails reporting two resources with the same name. Not for two models that merely select from the same source table.
TL;DR
Two files in the project (or across installed packages) define the same resource name, and dbt refuses to guess which one you mean. Find both files, rename one of them, or keep both and reference them with the two-argument ref('package_name', 'model_name') form.
Error
"dbt found two resources with the same name" duplicate modelSteps
- Run
dbt lsand read the full error; it names the colliding resource. Expected: you know the duplicate name. - Search the project for files with that base name: check
models/,seeds/,snapshots/, and installed packages underdbt_packages/. Expected: you find both definitions. - Decide: if one is stale, delete or rename it. Expected: only one file keeps the name.
- If both must stay (for example the same model name in two packages), update references to the two-argument form
ref('package_name', 'model_name'). Expected: every ref is unambiguous. - Run
dbt parseand thendbt compile. Expected: no duplicate-name error.
When to use
dbt parsefails with "found two resources with the same name".- You just installed a package that ships a model name you already use.
When not to use
- Two models read from the same source table (that is fine; names are what must be unique).
- A model and a test share a name pattern (tests live in a separate namespace).
Tool compatibility
- dbt Core 1.0 and later, all adapters. Resource uniqueness rules are adapter-independent.
Variant phrasings
dbt found two seeds / two snapshots with the same name
Same rule across resource types: seeds, snapshots, and models share one namespace per type.
Ambiguous reference after installing dbt-utils or a community package
The package brought a colliding name; scope your refs or rename your model.
Why it happens
dbt addresses nodes by name in ref(). Two nodes with one name make every downstream ref ambiguous, so dbt fails fast at parse time instead of picking one silently.
Edge cases
- A model and a seed with the same name also collide; rename the seed file.
- Disabled models still count for name uniqueness in some versions; check
enabledconfigs. - File name casing differences (
Orders.sqlvsorders.sql) collide on case-insensitive filesystems.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_TlIUMM0gXMGkUifYAVllRA
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.