Skip to main content

Warnings

Turning on the WARN_ERROR config will convert dbt warnings into errors. Any time dbt would normally warn, it will instead raise an error. Examples include --select criteria that selects no resources, deprecations, configurations with no associated models, invalid test configurations, or tests and freshness checks that are configured to return warnings.

Usage
dbt --warn-error run
...

Converting any warnings to errors may suit your needs perfectly, but there may be some warnings you just don't care about, and some you care about a lot. The WARN_ERROR_OPTIONS config gives you more granular control over exactly which types of warnings are treated as errors.

  • Warnings that should be treated as errors can be specified through error and/or warn parameters. Warning names can be found in dbt-core's types.py file, where each class name that inherits from WarnLevel corresponds to a warning name (e.g. AdapterDeprecationWarning, NoNodesForSelectionCriteria).

  • The error parameter can be set to "all" or "*" to treat all warnings as exceptions, or to a list of specific warning names to treat as exceptions. When error is set to "all" or "*", the optional warn parameter can be set to exclude specific warnings from being treated as exceptions.

  • Use the silence parameter to ignore warnings through project flags, without needing to re-specify the silence list every time. For example, to silence deprecation warnings or certain warnings you want to ignore across your project, you can specify them in the silence parameter. This is useful in large projects where certain warnings aren't critical and can be ignored to keep the noise low and logs clean.

dbt_project.yml
name: "my_dbt_project"
tests:
+enabled: True
flags:
warn_error_options:
error: # Previously called "include"
warn: # Previously called "exclude"
silence: # To silence or ignore warnings
- NoNodesForSelectionCriteria
WARN_ERROR and WARN_ERROR_OPTIONS are mutually exclusive

WARN_ERROR and WARN_ERROR_OPTIONS are mutually exclusive. You can only specify one, even when you're specifying the config in multiple places (e.g. env var + CLI flag), otherwise, you'll see a usage error.

dbt --warn-error-options '{"error": "all"}' run
...
dbt --warn-error-options '{"error": "all", "warn": ["NoNodesForSelectionCriteria"]}' run
...
dbt --warn-error-options '{"error": ["NoNodesForSelectionCriteria"]}' run
...
DBT_WARN_ERROR_OPTIONS='{"error": ["NoNodesForSelectionCriteria"]}' dbt run
...
profiles.yml
config:
warn_error_options:
error: # Previously called "include"
warn: # Previously called "exclude"
- NoNodesForSelectionCriteria
silence: # Silence or ignore warnings
- NoNodesForSelectionCriteria
0