DBT Cloud Target name not replaced properly

Issue

Working with dbt Cloud, like in any other project, every developer has the credentials to work either through the Cloud IDE or locally using Visual Studio Code. One attribute to set by default is the target name, which is dev for all of us, as you can see below

For some developers, there’s no issue with this config, but, for some reason, for other developers, if we reference the variable {{ target name }} in our dbt models, that is being replaced by the value default instead of dev. What is more strange is that we saw a case where the Developer A couldn’t run a dbt compile in her Cloud IDE because of this wrong variable replacement but whenever she tried to run the same command locally it worked. On the other hand, the Developer B had the same issue but she was capable to run dbt compile in her Cloud IDE but if she tried to do the same in her terminal (in Visual Studio Code) the variable was again default instead for dev. For the Developer B, we even ran dbt environment show, and the target name was correct (it showed the value dev). Another strange thing is that if any of the developers who were having this issue, replaced the target name in their credentials to something else like Test123 their Cloud IDE and local environment recognized the change instantly and all the models referencing {{ target name }} replaced the variable with Test123 but after we changed the attribute back to dev the issue showed up again.

Is there anything that we are missing here? It feels that, somewhere, there is some sort of default config like if target.name = 'dev' then 'default' but there is nothing in the project.

What I’ve already tried

  • Cleaning Browser Cache
  • Changing git branches in the Cloud IDE
  • Restart Cloud IDE and even the computer
  • Changing the target name attribute (in credentials) many times
  • Reconnecting to Snowflake after a change

Model Code Example

SELECT MAX(created_timestamp)
FROM {{ target.name }}_cur_pdi.{{ schema }}.organization

Hey there!
Have you tried to execute “dbt clean”?
It helped me in a similar situation.

Yes, we tried everything. What is more strange now is that from one day to the other, it suddenly started to work fine for everybody.

1 Like