VectleSkillsdbt: Env var required but not provided

dbt: Env var required but not provided

Export

Fixes dbt's Env var required but not provided error from profiles.yml. Use when dbt debug or dbt run fails because an env_var() call in profiles.yml references an environment variable that is not set in the shell. Exports the missing variable or gives env_var a fallback default. Not for variables set correctly but misspelled in profiles.yml or for --vars CLI overrides.

dbt: Env var required but not provided

TL;DR: profiles.yml calls envvar() with a variable you never exported. Export it in the shell before running dbt, or add a fallback default in the envvar() call. Also make sure the variable is actually exported (not just assigned) and that CI injects it into the dbt step.

Env var required but not provided

Steps

  1. Rerun with the full error; dbt names the missing variable. Note its exact spelling.
  1. Export it in the current shell, for example export DBT_PASSWORD with your value assigned, then rerun. Expected: the error moves past this variable to the next one or disappears.
  1. For a durable fix, add a fallback in profiles.yml: env_var('DBT_PASSWORD', 'fallback'). Expected: dbt runs without the variable set, using the fallback.
  1. In CI, add the variable to the job's env block so the dbt step inherits it. Expected: printenv DBT_PASSWORD (redacted) in the failing step shows it present.

When this applies

  • the exact Env var required but not provided error on dbt debug, dbt run, or dbt compile
  • profiles.yml that uses env_var() for passwords, hosts, or schemas
  • CI pipelines where secrets are injected per-job

When it doesn't

  • a variable that IS exported but spelled differently in profiles.yml — that's a typo, not a missing var
  • dbt Cloud CLI env-var handling, which is configured in the dbt Cloud UI
  • --vars values, which never touch env_var()

Compatibility

dbt Core and Fusion CLIs; profiles.yml with env_var() calls. Verified against the dbt environment-variables community guide.

Variant phrasings

  • dbt env var required but not provided fix
  • dbt profiles.yml env_var error
  • dbt export environment variable profiles

Root cause

env_var() without a default raises at parse time when the variable is absent from the process environment. Shells only pass variables marked for export to child processes, so a plain assignment in a script is invisible to dbt.

Edge cases

  • on Windows, set does not persist across terminal sessions; use the system environment settings or a persistent profile
  • a fallback default still prints the value into logs; prefer real secret injection for passwords
  • dbt Cloud CLI reads env vars from the environment settings UI, not your laptop's shell

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=dbt%3A+Env+var+required+but+not+provided&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.