Skip to content

fix(eval): surface validation errors for malformed eval set files (#8493) - #8517

Open
severus0044 wants to merge 1 commit into
google:mainfrom
severus0044:fix/issue-8493-20261205
Open

severus0044 wants to merge 1 commit into
google:mainfrom
severus0044:fix/issue-8493-20261205

Conversation

@severus0044

Copy link
Copy Markdown

Problem / Why

adk eval loads an eval set with EvalSet.model_validate_json. When that fails it currently assumes the file is in the legacy list format and calls convert_eval_set_to_pydantic_schema. A malformed new-format file is a dict, so the legacy converter iterates its keys and raises TypeError: string indices must be integers, not 'str', hiding the real ValidationError (userContent: Field required).

Fixes #8493.

Changes

  • Check the parsed JSON shape before using the legacy converter.
  • Re-raise the original ValidationError when the top-level value is not a list.
  • Keep the legacy list-format conversion unchanged.

Verification

  • Offline AST/stub harness: malformed dict input raises ValidationError with Field required; the legacy converter is not called; old source raises TypeError.
  • pytest -q tests/unittests/evaluation/test_local_eval_sets_manager.py -k malformed with a new regression test; plus existing old-format conversion tests.

Notes / Scope

No schema, CLI flag or output-format change. Invalid JSON still raises its existing parse error from model_validate_json; this PR only stops masking schema validation errors on dict-shaped files.

@google-cla

google-cla Bot commented Dec 5, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

adk eval crashes with a raw TypeError on a malformed eval set file instead of reporting the validation error

1 participant