dbt accepted_values test failure in CI
A dbt accepted_values test found rows whose column value is not in the declared allowed set. dbt fails because the count of disallowed values is not zero.
What this error means
A dbt test step fails with "Failure in test accepted_values_<model>_<column>__<values>" and "Got N results, configured to fail if != 0".
dbt
Failure in test accepted_values_orders_status__placed__shipped__cancelled
Got 4 results, configured to fail if != 0
found status values not in ('placed','shipped','cancelled')Common causes
A new or unexpected category value appeared
Upstream data introduced a status or type value the test does not list, so those rows fail.
The accepted set is stale
A legitimate new value was added to the domain but the test was not updated to include it.
How to fix it
Inspect the unexpected values
- Run the compiled test SQL or
--store-failuresto see the offending values. - Decide whether they are bad data or a legitimate new category.
- Fix the data, or update the accepted set if the value is valid.
Terminal
dbt test --select accepted_values_orders_status --store-failuresUpdate the accepted values list
When the new value is legitimate, add it to the list so the test reflects the real domain.
schema.yml
- accepted_values:
values: ['placed', 'shipped', 'cancelled', 'returned']How to prevent it
- Keep accepted-value lists in sync with the real domain.
- Store failures so unexpected values are visible.
- Treat new categories as a review event, not a silent pass.
Related guides
dbt test "Failure ... got N results, expected 0" (unique) in CIFix a dbt unique test that fails with "Got N results, configured to fail if != 0" in CI. Duplicate values exi…
dbt not_null / relationships test failure in CIFix dbt not_null and relationships test failures in CI, both reported as "Got N results, expected 0". Nulls i…
dbt "Compilation Error" in tests in CIFix a dbt "Compilation Error" in CI. dbt could not compile a test or model, usually from an undefined ref, ma…