Skip to content
Latchkey

Great Expectations "ExpectationSuite ... failed" validation in CI

Great Expectations ran your ExpectationSuite against a batch and at least one expectation was not met, so the result is "success": false. This is a real data defect the suite is meant to catch, and the CI step exit code should reflect it.

What this error means

A great_expectations validation step reports one or more unsuccessful expectations and an overall "success": false, and you want CI to fail (non-zero exit) when that happens.

great_expectations
Validation failed for suite "orders.warehouse" against batch "orders_2026_06_30":
  expect_column_values_to_not_be_null(column=customer_id): success=False (unexpected 412 of 10000)
Overall success: False

Common causes

The data genuinely violates an expectation

A column has nulls, out-of-range values, or duplicates that the suite forbids. The validation is doing its job; the upstream data or transform is the defect.

The suite runs but its result never gates the job

The Python or CLI step captures success but does not translate it into a non-zero exit code, so CI stays green even though validation failed.

How to fix it

Gate CI on the validation result

  1. Run the checkpoint or validation and read the returned success flag.
  2. Exit non-zero when it is false so the workflow step fails.
  3. Keep the Data Docs artifact so reviewers can see which expectation broke.
validate.py
import great_expectations as gx
context = gx.get_context()
result = context.run_checkpoint(checkpoint_name="orders_checkpoint")
if not result["success"]:
    raise SystemExit(1)

Fix the data or adjust an over-strict expectation

If the failure is a real defect, fix the upstream model. If the expectation is wrong (for example a mostly-not-null column), set a mostly threshold rather than deleting the check.

expectation
# allow up to 1% nulls instead of demanding zero
expect_column_values_to_not_be_null(column="customer_id", mostly=0.99)

How to prevent it

  • Always translate success: false into a non-zero exit in CI.
  • Use mostly thresholds for expectations that tolerate a known small rate.
  • Publish Data Docs as an artifact so failures are inspectable.

Related guides

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