Skip to content

[BUG] Misleading warning when evaluating Jinja in dbt_project.yml fails #387

@fornwall

Description

@fornwall

Describe the bug
Consider this section of a dbt_project.yml file:

models:
  my_model:
    +hours_to_expiration: "{{ env_var('MY_ENV_VAR') }}"

If MY_ENV_VAR is not defined:

Parsing this with dbt-core gives the error:

01:52:34 Encountered an error:
Parsing Error
Env var required but not provided: 'MY_ENV_VAR'

Parsing this with dbtf gives the warning:

warning: (will error post beta) dbt1060: Ignored unexpected key "my_model". YAML path: my_model.
[..]
warning: dbt1000: Warnings marked (will error post beta) will turn into errors before leaving beta. Please fix them.
suggestion: Try the autofix script: https://github.com/dbt-labs/dbt-autofix

Note the misleading warning message about my_model being an unexpected key and the misleading suggestion about the autofix script.

What version of dbt Fusion is this bug in? (find out by running dbt --version)
v2.0.0-beta.37

Is this a discrepancy between the dbt Fusion Engine and dbt Core? Check one.

  • YES
  • NO

To Reproduce

See full dbt project to reproduce this here.

Try to parse a dbt_project.yml where the jinja evaluation fails (such as one with the snippet given above).

Expected behavior
A clear error message about the failure should be shown.

Operating System and CPU Type (please complete the following information):
Not applicable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas-reproHas a reproducible example

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions