dbt-labs / dbt-labs/dbt

Full parse hangs indefinitely in jsonschema._keywords.anyOf when project has many MissingArgumentsPropertyInGenericTestDeprecation instances (regression in 2026.4.6)

Open
#12,832 2 comments 0 reactions 0 assignees View on GitHub
engine:v1 regression status:triage type:bug
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

### Is this a regression in a recent version of dbt-core?

- [x] I believe this is a regression in dbt-core functionality
- [x] I have searched the existing issues, and I could not find an existing issue for this regression

### Current Behavior

Full project parse hangs indefinitely inside `jsonschema._keywords.anyOf` while validating generic test configs. After 10 minutes of inactivity, the process is killed by SIGINT (KeyboardInterrupt). No SQL queries are ever executed - the job dies entirely during parsing. Warm partial-parse runs succeed; only full parses are affected.

The project contains 135 generic tests using the deprecated top-level argument format (MissingArgumentsPropertyInGenericTestDeprecation), which appears to trigger the hang.

### Expected/Previous Behavior

Prior to 2026.4.6, full parses completed successfully on the same project with the same test configurations. The deprecated test format was slow to validate but did not cause an indefinite hang.

### Steps To Reproduce

1. Have a dbt project with a large number (100+) of generic tests using the deprecated top-level argument format, e.g.:
```yaml
- relationships:
to: ref('some_model')
field: id
```
2. Run `dbt parse --no-partial-parse` on dbt-core 2026.4.6
3. Observe the process hanging indefinitely inside `jsonschema._keywords.anyOf`
4. Process is eventually killed — no models execute

### Relevant log output

```shell
KeyboardInterrupt
File ".../jsonschema/_keywords.py", line ..., in anyOf
...
(Process killed after 10-minute inactivity timeout — SIGINT → KeyboardInterrupt)
```

### Environment

```markdown
- OS: Linux (dbt Cloud)
- Python: 3.10+
- dbt-core (working version): pre-2026.4.6
- dbt-core (regression version): 2026.4.6+69ba8e9
- Database adapter: Snowflake
```

### Which database adapter are you using with dbt?

snowflake

### Additional Context

This regression was introduced by three PRs merged March 23, 2026:
- #12685 — Use pre-jinja schemas for jsonschema deprecations (sync from dbt-fusion)
- #12618 — Fix: raise correct deprecation when config key is top-level in generic test
- #12667 — Add config key check for all keys and simplify the deprecation logic

#12685 converted simple scalar fields into `anyOf` schemas with a Jinja branch (`{ type: "string", pattern: "^\{.*\}$" }`). The `jsonschema` library's `anyOf` validation has known quadratic/exponential complexity on large nested schemas. With 135 deprecated tests each triggering full schema validation on a cold parse, this causes an indefinite hang.

Note: `jsonschema` itself was not bumped in this release — the regression is from schema/usage changes, not a library version change.

**Workaround:** Migrate affected tests to the nested `arguments:` format:
```yaml
- relationships:
arguments:
to: ref('some_model')
field: id
```
Find affected tests with:
`dbt --show-all-deprecations parse --no-partial-parse 2>&1 | grep MissingArgumentsPropertyInGenericTest`

**Potential fixes:**
1. Short-circuit jsonschema validation for deprecation checks when many legacy tests are detected
2. Pre-compile/memoize `Draft7Validator` rather than re-instantiating per test
3. Long-term: replace `jsonschema` with `fastjsonschema` (see #10248)

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.