dbt-labs / dbt-labs/dbt

[v2 Bug] panics when both tests: and data_tests: are set

Open
#15,958 0 comments 0 reactions 0 assignees View on GitHub
area:engine type:bug
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

When a `dbt_project.yml` defines both `tests:` and `data_tests:`, dbt v2 panics:

```
not implemented: Merge logic for tests and data tests is unimplemented
```

The panic is in `build_root_project_configs` and again in `resolve_data_tests`. The message is misleading — dbt 1.x does not merge these keys.

### Expected Behavior

Match dbt 1.x: a config error, not a process abort.

```
Invalid project config: cannot have both 'tests' and 'data_tests' defined
```

### Steps To Reproduce

1. In `dbt_project.yml`, set both:

```yaml
tests:
+enabled: true
data_tests:
+tags: super
```

2. Run `dbt parse`
3. v2 panics at `unimplemented!("Merge logic for tests and data tests is unimplemented")`

### Relevant log output

```
thread '...' panicked at crates/dbt-parser/src/dbt_project_config.rs:
not implemented: Merge logic for tests and data tests is unimplemented
```

### Environment

- OS: macOS
- CPU: ARM
- dbt distribution and version: dbt-core `main` (v2)

### Is this a discrepancy vs. dbt 1.x?

- [x] Yes — this works in dbt 1.x but not in dbt v2.x

### Additional Context

dbt 1.x raises `ValidationError` in `core/dbt/contracts/project.py` (`Invalid project config: cannot have both 'tests' and 'data_tests' defined`) and has a functional test in `tests/functional/deprecations/test_config_deprecations.py`. Docs also say you cannot have both keys on the same resource.

I plan to replace the two `unimplemented!` arms with that error (no merge) and add a `dbt-parser` unit test. `cargo nextest run -p dbt-parser`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.