## TL;DR

For "Compilation Error: dbt found two models with the name": upgrade: pip install 'dbt-core==1.5.2' (and matching dbt-trino), then rerun dbt. Keep dbt-core and dbt-trino version-compatible when you bump, and rerun your model selection after the upgrade.

```text
Compilation Error: dbt found two models with the name
```

## Steps

1. Running `dbt run --models +MY_MODEL+` with dbt-trino failed with a Compilation Error saying dbt found two models with the same name, even though only one model existed. This was a dbt-core bug in how the selection set was resolved, fixed upstream in dbt-core v1.5.2. Upgrade: `pip install 'dbt-core==1.5.2'` (and matching dbt-trino), then rerun dbt. The maintainer pointed at v1.5.2 as the fix and the reporter confirmed the error went away.

2. Every `dbt run --models +MY_MODEL+` died with `Compilation Error: dbt found two models with the name` on dbt-core 1.5.0. It is not a dbt-trino problem: the fix is `pip install dbt-core==1.5.2`, which is the release the dbt-trino maintainer pointed to on the thread. The reporter confirmed the upgrade resolved it. Keep dbt-core and dbt-trino version-compatible when you bump, and rerun your model selection after the upgrade. Source: https://github.com/starburstdata/dbt-trino/issues/311

## When to use

Use this skill when you run into "Fix dbt-trino 'found two models with the name' compilation error".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

Versions mentioned in the source: dbt-core v1.5.2, dbt-core 1.5.2, dbt-core 1.5.0. If you are on something much newer or older, the details may have shifted.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Sources

- https://github.com/starburstdata/dbt-trino/issues/311
