OpenBB-finance/OpenBB · error · OpenBBError

Error transforming the data -> {e}

Error message

Error transforming the data -> {e}

What it means

Catch-all wrapper around the whole transform stage of the EIA Petroleum Status Report: any exception while parsing tables, concatenating, sorting, or validating rows (including the empty-data case) is re-raised as OpenBBError with this prefix. The original exception is chained (from e), so the text after '->' identifies the real failure.

Source

Thrown at openbb_platform/providers/eia/openbb_us_eia/models/petroleum_status_report.py:241

                executor.map(
                    lambda table: read_excel_file(file, category, table), tables
                )

            results = concat(dfs)

            if len(results) < 1:
                raise EmptyDataError("The data is empty.")

            results = results.sort_values(by=["date", "table", "order"]).replace(
                {nan: None}
            )

            return [
                EiaPetroleumStatusReportData.model_validate(d)
                for d in results.to_dict(orient="records")
            ]
        except Exception as e:  # pylint: disable=broad-except
            raise OpenBBError(f"Error transforming the data -> {e}") from e

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Inspect the chained cause — run with the full traceback or catch OpenBBError and print .original / __cause__ to see the underlying exception.
  2. Update the openbb-us-eia provider to the latest version for current workbook parsing.
  3. Clear the cached file by retrying with use_cache=False.
  4. If the cause is EmptyDataError, follow error 327's guidance; if validation, simplify to the default table set.
Defensive patterns

Strategy: try-catch

Try / catch

try:
    res = await obb.energy.petroleum_status_report(category=cat, table=tbl, provider='eia')
except OpenBBError as e:
    cause = repr(e.__cause__ or e.original)
    if 'EmptyDataError' in cause:
        return []  # no data is not an error for the pipeline
    if 'api_key' in str(e):
        raise RuntimeError('Fix EIA credentials') from e
    raise

Prevention

When it happens

Trigger: Any of: EmptyDataError from empty results (error 327); KeyError from missing sheet/table names; pandas errors from sort_values on missing columns; pydantic validation errors on malformed records; the TypeError from a non-ExcelFile payload (error 326).

Common situations: EIA workbook layout changes breaking column expectations; outdated provider version against a new report format; corrupted cached downloads; invalid table/category combos that slipped past param validation.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/a327ea316f0d20e0. Report an issue: GitHub.