Skip to content

Comments

Fix incorrect exception_info structure when raised_exception is True#11657

Open
Mr-Neutr0n wants to merge 1 commit intogreat-expectations:developfrom
Mr-Neutr0n:fix/flatten-exception-info-structure
Open

Fix incorrect exception_info structure when raised_exception is True#11657
Mr-Neutr0n wants to merge 1 commit intogreat-expectations:developfrom
Mr-Neutr0n:fix/flatten-exception-info-structure

Conversation

@Mr-Neutr0n
Copy link

Summary

Fixes #10849

When a metric resolution error occurs during validation (e.g. referencing a non-existent column), the exception_info dict on the result gets structured as:

{"('column_values.nonnull.condition', '242ce...', ())": {"raised_exception": True, "exception_traceback": "...", "exception_message": "..."}}

instead of the expected flat structure:

{"raised_exception": True, "exception_traceback": "...", "exception_message": "..."}

This happens because _resolve_suite_level_graph_and_process_metric_evaluation_errors in validator.py passes the raw metric_exception_info dict (keyed by metric ID strings) directly as the exception_info argument to ExpectationValidationResult. Every other exception handling path in the validator correctly passes a single ExceptionInfo object.

The fix extracts the ExceptionInfo from the first failing metric and passes it directly, making the structure consistent across all code paths. This matches how the renderers in expectation.py already handle this case — they iterate the dict and break after the first entry.

Changes

  • great_expectations/validator/validator.py: Extract the first ExceptionInfo value from metric_exception_info before passing it to ExpectationValidationResult, instead of passing the entire dict keyed by metric identifiers.

Test plan

  • Validate that result.exception_info["raised_exception"] returns True directly (no nested key)
  • Validate that result.exception_info["exception_message"] and result.exception_info["exception_traceback"] are accessible at the top level
  • Confirm existing renderers in expectation.py still work (they check "raised_exception" in result.exception_info first, which now succeeds on the first branch)
  • Existing tests pass since get_exception_info() itself is unchanged

When metric resolution errors occur during validation, the exception_info
dict was being passed with metric identifier keys wrapping the actual
exception data, e.g. {"('column_values.nonnull.condition', ...)" : {...}}.

This made it impossible to programmatically check result.exception_info
for raised_exception, exception_message, or exception_traceback since
the keys were unpredictable metric identifiers rather than the expected
flat structure.

The fix extracts the ExceptionInfo from the first failing metric and
passes it directly, consistent with all other exception handling paths
in the validator.

Fixes great-expectations#10849
@netlify
Copy link

netlify bot commented Feb 13, 2026

‼️ Deploy request for niobium-lead-7998 rejected.

Name Link
🔨 Latest commit e21b48f

@gx-cla-bot
Copy link

gx-cla-bot bot commented Feb 13, 2026

A new contributor, HUZZAH! Welcome and thanks for joining our community. In order to accept a pull request we require that all contributors sign our Contributor License Agreement. We have two different CLAs, depending on whether you are contributing to GX in a personal or professional capacity. Please sign the one that is applicable to your situation so that we may accept your contribution:

Individual Contributor License Agreement v1.0
Software Grant and Corporate Contributor License Agreement v1.0

Once you have signed the CLA, you can add a comment with the text @cla-bot check and the bot will update the PR status!

Please reach out to the #gx-community-support channel, on our Slack if you have any questions or if you have already signed the CLA and are receiving this message in error.

Users missing a CLA: mr-neutr0n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect validation_result["results"]["exception_info"] structure when raised_exception == True

1 participant