Skip to content
Latchkey

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

  1. Run the compiled test SQL or --store-failures to see the offending values.
  2. Decide whether they are bad data or a legitimate new category.
  3. Fix the data, or update the accepted set if the value is valid.
Terminal
dbt test --select accepted_values_orders_status --store-failures

Update 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →