Skip to content

fix: #351 make serde errors more informative#806

Merged
elijahbenizzy merged 1 commit into
apache:mainfrom
adawang1210:fix/issue-351-informative-serde-errors
Jun 13, 2026
Merged

fix: #351 make serde errors more informative#806
elijahbenizzy merged 1 commit into
apache:mainfrom
adawang1210:fix/issue-351-informative-serde-errors

Conversation

@adawang1210

Copy link
Copy Markdown
Contributor

Summary

Serializing state that contains a pandas DataFrame without configuring pandas_kwargs failed with an opaque internal error (TypeError: serialize_pandas_df() missing 1 required positional argument: 'pandas_kwargs', or KeyError: 'path' if path was missing). There was also no way to tell which state field failed. Serde failures now raise clear, actionable errors.

Before:

TypeError: serialize_pandas_df() missing 1 required positional argument: 'pandas_kwargs'

After:

ValueError: Failed to serialize state field 'output' (value of type DataFrame): Serializing a pandas
DataFrame requires a `path` entry in `pandas_kwargs` -- this is the base path where the dataframe is
saved as a parquet file. Pass it through whatever triggers serialization, e.g.
`LocalTrackingClient(..., serde_kwargs={"pandas_kwargs": {"path": "/some/dir"}})` or
`state.serialize(pandas_kwargs={"path": "/some/dir"})`. Got pandas_kwargs=None.

Related issue

Addresses the "make it clear if we do not have the values we need" and "type-check the values coming in" parts of #351.

Changes made

  • burr/integrations/serde/pandas.py: pandas_kwargs is now optional in the signature; the serializer validates it and raises an informative ValueError when path is missing; the deserializer no longer requires pandas_kwargs at all (the parquet path is embedded in the serialized value).
  • burr/core/state.py: State.serialize / State.deserialize wrap serde failures with the offending field name (chained with from e so the original traceback is preserved).
  • burr/core/serde.py: unknown deserializer keys now report the registered keys and hint that the registering module may not have been imported.
  • tests/core/test_serde.py, tests/integrations/serde/test_pandas.py: cover the missing-kwargs, missing-path, unknown-key, and kwargs-free deserialization cases.

How to test

pytest tests/core/test_serde.py tests/integrations/serde/test_pandas.py

Checklist

  • Tests added or updated
  • All tests pass locally (pytest tests/ --ignore=tests/integration_tests: 577 passed, 5 skipped)
  • Commits signed off (git commit -s)
  • Pre-commit hooks pass (black, isort, flake8)
  • CONTRIBUTING.md guidelines followed

Pandas serde now raises a clear ValueError explaining the required pandas_kwargs 'path' entry instead of an opaque TypeError/KeyError; State.serialize/deserialize wrap failures with the offending field name; unknown deserializer keys now list registered keys and hint at the missing registration import.

Signed-off-by: adawang <adawang12101210@gmail.com>
@github-actions github-actions Bot added area/core Application, State, Graph, Actions area/integrations External integrations (LLMs, frameworks) labels Jun 11, 2026

@elijahbenizzy elijahbenizzy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seesms reasonable

@elijahbenizzy elijahbenizzy enabled auto-merge (squash) June 13, 2026 05:58
@elijahbenizzy elijahbenizzy merged commit 38f49b6 into apache:main Jun 13, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Application, State, Graph, Actions area/integrations External integrations (LLMs, frameworks)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants