[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()
- Dominant language
- Rust
- Stars
- 13.8k
- Forks
- 2.6k
- Avg merge
- 21h 31m
- Merged PRs (30d)
- 56
Description
### Is this a new bug in dbt v2.x compared to the latest version of dbt 1.x?
- [x] I believe this is a new bug in dbt v2.x
- [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](https://github.com/dbt-labs/dbt-core/issues/15536) 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.:
```sql
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
```shell
```
### Environment
```markdown
- 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
Contributor guide
Assessment
This issue has not been assessed yet.