Skip to content

[v2 Bug] dbt lint --fix: rendered mode (enforced) renders union_relations to empty CTE, causing SyntaxInvalid (dbt0101) for dbt_utils macros that use adapter.get_relation() #15978

Description

@devxor

Is this a new bug in dbt v2.x compared to the latest version of dbt 1.x?

  • I believe this is a new bug in dbt v2.x
  • I have searched the existing issues and could not find a duplicate

Current Behavior

dbt lint --fix enforces --jinja-render-mode rendered (symbolic is explicitly
blocked with dbt1007). In rendered mode without a real database connection,
dbt_utils.union_relations() calls adapter.get_relation() for each relation,
receives None (no warehouse available in lint context), skips all relations,
and renders the CTE body to an empty string — producing invalid SQL.

If you try to run dbt lint --fix --jinja-render-mode symbolic, dbt rejects it immediately with this error:

Error [InvalidArgument (dbt1007)]: `--fix`/`format` is not supported with
`--jinja-render-mode symbolic`. Use `--jinja-render-mode rendered` (or `turbo`)
to fix/format, or drop `--fix` to lint.

I have already reported this issue some time ago and the response/workaround was to use symbolic mode, which was blocked right now in fusion version .209.

Expected Behavior

--fix should handle warehouse-dependent adapter calls gracefully in lint
context — either by hole-punching them (as symbolic mode does) or by skipping
files that cannot be fully rendered without a database connection.

Steps To Reproduce

  1. Use dbt_utils.union_relations() in a model, e.g.:
    with unioned_regions as (
        {{ dbt_utils.union_relations(relations=[ref('model_a'), ref('model_b')]) }}
    )
    select * from unioned_regions
  2. Run dbt lint --fix

Relevant log output

Environment

- OS: Ubuntu 24.04.4 LTS
- CPU: (x86 or ARM)
- dbt distribution and version: dbt-fusion 2.0.0-preview.209

Which database adapter are you using?

snowflake

Is this a discrepancy vs. dbt 1.x?

  • Yes — this works in dbt 1.x but not in dbt v2.x

Additional Context

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:adaptersThe adapter framework/layer connecting Fusion to warehouses (dbt-adapter* crates).bugengine:v2Concerns the dbt Fusion (v2) engine.snowflakestatus:triageAwaiting initial triage / categorization.triagetype:bugA defect: Fusion behaves incorrectly versus expected/reference behavior.v2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions