OpenBB-finance/OpenBB · error · OpenBBError

Error extracting data -> {e}

Error message

Error extracting data -> {e}

What it means

Extraction-stage wrapper in the EIA Petroleum Status Report fetcher: the Excel file download for the category's URL (from WpsrFileMap) failed with an OpenBBError, which is re-wrapped with this prefix. The root cause is visible after the '->' — typically a 403 API-key rejection or a network/download failure from the underlying download_excel_file helper.

Source

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

        return EiaPetroleumStatusReportQueryParams(**params)

    @staticmethod
    async def aextract_data(
        query: EiaPetroleumStatusReportQueryParams,
        credentials: dict[str, Any] | None,
        **kwargs: Any,
    ) -> dict:
        """Extract the data from the EIA website."""
        # pylint: disable=import-outside-toplevel
        from openbb_us_eia.utils.helpers import download_excel_file

        url = WpsrFileMap.get(query.category, "balance_sheet")

        try:
            results = await download_excel_file(url, query.use_cache)
        except OpenBBError as e:
            raise OpenBBError(f"Error extracting data -> {e}") from e

        return {"file": results}

    @staticmethod
    def transform_data(
        query: EiaPetroleumStatusReportQueryParams,
        data: dict,
        **kwargs: Any,
    ) -> list[EiaPetroleumStatusReportData]:
        """Transform the data."""
        # pylint: disable=import-outside-toplevel
        import concurrent.futures  # noqa
        import re
        from functools import lru_cache
        from numpy import nan
        from pandas import Categorical, ExcelFile, concat, read_excel
        from warnings import warn

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Read the text after 'Error extracting data -> ' — it carries the underlying cause (403 key error, network error, etc.).
  2. Verify and re-enter the EIA API key (obb.user.credentials.eia.api_key) and retry.
  3. Retry with use_cache=False in case a cached failed response is being replayed.
  4. If the URL itself 404s, the WpsrFileMap may need updating — check the provider repo for fixes.
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:
    msg = str(e)
    if 'api_key' in msg or '403' in msg:
        raise RuntimeError('EIA API key missing/invalid — set obb.account.credentials') from e
    if 'downloading' in msg:
        await asyncio.sleep(5)
        res = await obb.energy.petroleum_status_report(category=cat, table=tbl, provider='eia', use_cache=False)
    else:
        raise

Prevention

When it happens

Trigger: EIA returns HTTP 403 because the api_key is missing/invalid (surfaced as '{code} -> {msg}'); the EIA site is unreachable; the URL in WpsrFileMap for the category is stale and returns an error page instead of an .xlsx file.

Common situations: Missing or expired EIA API key in OpenBB credentials; EIA redesigning their weekly petroleum report file paths; corporate proxies/firewalls blocking the download; transient outages on eia.gov.

Related errors


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