Warnings
Use the --warn-error flag to promote all warnings to errors or --warn-error-options for granular control through options.
Use --warn-error
to promote all warnings to errors
Enabling WARN_ERROR
config or setting the --warn-error
flag will convert all 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.
dbt --warn-error run
Use --warn-error-options
for targeted warnings
In some cases, you may want to convert all warnings to errors. However, when you want some warnings to stay as warnings and only promote or silence specific warnings you can instead use --warn-error-options
. The WARN_ERROR_OPTIONS
config or --warn-error-options
flag gives you more granular control over exactly which types of warnings are treated as errors.
WARN_ERROR
and WARN_ERROR_OPTIONS
are mutually exclusiveWARN_ERROR
and WARN_ERROR_OPTIONS
are mutually exclusive. You can only specify one, even when you're specifying the config in multiple places (like env var or a flag), otherwise, you'll see a usage error.
Configuration
You can configure warnings as errors or which warnings to silence, by warn error options through command flag, environment variable, or dbt_project.yml
.
Examples
Here are some examples that show you how to configure warn_error_options
using flags or file-based configuration.
Target specific warnings
Some of the examples use NoNodesForSelectionCriteria
, which is a specific warning that occurs when your --select
flag doesn't match any nodes/resources in your dbt project:
Promote all warnings to errors
Some examples of how to promote all warnings to errors:
using dbt command flags
using environment variables
Note, as mentioned earlier, using will treat all current and future warnings as errors.
This means that if a new warning is introduced in a future version of dbt Core, your production job may start failing unexpectedly. We recommend proceeding with caution when doing this in production environments, and explicitly listing only the warnings you want to treat as errors in production.