dbt found two models with the name? Give me solution

Hello, Expert.

I’m doing dbt compile in my project model, after the code that was compiled target folder is created inside my model folder, and then I compile once again.I get the message “dbt found two models with the name”.

Note: I don’t have a duplicate model name .
problem is target folder has been created within my model folder.

target folder has been created within my model folder

It would help to know more details about this. Would you be able to share a screenshot of the relevant parts of your file tree, showing where the target folder is created?

Did you intend for your target folder to be where it is? If not, you could delete it and recreate a target folder in th standard location using a dbt compile command.

Finally, if you review your full error message (not only the “dbt found two models with the name” part, but the specification of the relevant model name) I believe that might point you in the right direction.

This similar question might also help: Compilation Error dbt found two models with the name

New to dbt, just started today :slight_smile: got this error too. For me it was because the target ( and dbt_packages) dirs get created in whatever dir you are in when you run the dbt run command. ( Least in v 1.5.0 )

Given that i was in the models dir when i did a dbt run… then that’s where they ended up causing the duplicate model.

Just delete the two dirs and do a dbt run from inside the project dir not any of the sub dirs :smiley:
Hope that helps anybody else starting out…

1 Like