NoneType object has no attribute 'database'" dbt run
Fixes the dbt adapter crash where credentials resolve to nothing, by running dbt debug and repairing the profile target, profiles location, or required fields. Use when dbt run or dbt debug crashes with this AttributeError. Not for warehouse-side errors after a successful connection.
TL;DR
The adapter received no usable credentials object, so the first attribute access on it crashes. This almost always means the profile is broken: the target name is misspelled, profiles.yml is not where dbt looks, or a required field is missing. Run dbt debug and fix whatever it flags first.
Error
"NoneType object has no attribute 'database'" dbt runSteps
- Run
dbt debug. Expected: it either shows the real profile error or crashes the same way, both of which are informative. - Confirm dbt is reading the profiles.yml you think it is: check
~/.dbt/profiles.ymlexists, or thatDBT_PROFILES_DIRpoints at the right directory. Expected: the file exists at the resolved location. - Open profiles.yml and check the target name matches what you pass (the default target is
dev). Expected: a top-level profile key with a matching target underneath it. - Check that every required field for your adapter is present (account, warehouse, database, schema for Snowflake; project, dataset for BigQuery). Expected: no required field is missing or empty.
- Re-run
dbt debug, thendbt run. Expected: debug passes and the run starts normally.
When to use
- dbt crashes with
NoneType ... has no attribute 'database'(or similar attribute) before connecting. - You just edited profiles.yml or switched machines.
When not to use
- dbt connects and then the warehouse rejects the credentials (an auth error, not a NoneType crash).
- The traceback points at your model SQL rather than adapter code.
Tool compatibility
- dbt Core 1.0 and later, all adapters. The exact missing attribute varies by adapter.
Variant phrasings
'NoneType' object has no attribute 'schema' / 'account' / 'warehouse'
Same root cause with a different attribute name; the profile is still the suspect.
Adapter crashes immediately on dbt debug
Often the same broken-profile problem surfacing one step earlier.
Why it happens
dbt builds a credentials object from the profile target. When the target lookup fails, the adapter gets None instead of credentials, and the first attribute access on it raises AttributeError deep in adapter code.
Edge cases
- A YAML indentation error can silently drop the whole target block, producing this crash with no useful message.
- Multiple profiles.yml files (project dir vs home dir) cause confusion about which one dbt reads;
dbt debugprints the path. - Environment-variable credentials that resolve empty produce a credentials object with null fields rather than this crash; that fails later at connect time.
Provenance
Resolved from the public thread: https://vectle.com/posts/pstnuRG9ykPSUylN38Zqt68Q
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.