Skip to content
Latchkey

dbt "Credentials in profile target invalid" in CI

dbt parsed profiles.yml but the credentials block for the active target is missing a required key or has an empty value. In CI this is almost always an env_var that resolved to an empty string because a secret was not set.

What this error means

dbt debug or dbt run fails at startup with "Credentials in profile 'X', target 'Y' invalid" and a Validation Error naming the missing or empty field.

dbt
Runtime Error
  Credentials in profile "my_project", target "ci" invalid: 'account' is a required property

Common causes

A required connection field is absent for this target

The target block omits a key the adapter requires (account, host, database, schema), so validation rejects the profile before any connection is attempted.

An env_var rendered to empty in CI

A field set to "{{ env_var('DBT_ACCOUNT') }}" produced an empty value because the secret was never exposed to the job, so the field reads as absent.

How to fix it

Complete the target block and inject secrets

  1. Read the field named in the Validation Error and add it to the active target.
  2. Set the corresponding secret in CI so any env_var resolves to a real value.
  3. Run dbt debug --target ci to confirm the credentials validate.
profiles.yml
my_project:
  target: ci
  outputs:
    ci:
      type: snowflake
      account: "{{ env_var('DBT_ACCOUNT') }}"
      user: "{{ env_var('DBT_USER') }}"
      password: "{{ env_var('DBT_PASSWORD') }}"
      database: analytics
      schema: dbt_ci

Expose the secrets to the step

Map repository secrets into the job env so profiles.yml env_var calls have values at parse time.

.github/workflows/ci.yml
env:
  DBT_ACCOUNT: ${{ secrets.DBT_ACCOUNT }}
  DBT_USER: ${{ secrets.DBT_USER }}
  DBT_PASSWORD: ${{ secrets.DBT_PASSWORD }}

How to prevent it

  • Keep all connection secrets in CI secrets and reference them via env_var.
  • Run dbt debug as an early CI step so a bad profile fails fast.
  • Validate profiles.yml against the adapter fields for each target.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →