{"record":{"id":"fccc8d1cd2cc10fc","repo":"OpenBB-finance/OpenBB","slug":"error-extracting-data-e","errorCode":null,"errorMessage":"Error extracting data -> {e}","messagePattern":"Error extracting data -> (.+?)","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/eia/openbb_us_eia/models/petroleum_status_report.py","lineNumber":128,"sourceCode":"\n        return EiaPetroleumStatusReportQueryParams(**params)\n\n    @staticmethod\n    async def aextract_data(\n        query: EiaPetroleumStatusReportQueryParams,\n        credentials: dict[str, Any] | None,\n        **kwargs: Any,\n    ) -> dict:\n        \"\"\"Extract the data from the EIA website.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from openbb_us_eia.utils.helpers import download_excel_file\n\n        url = WpsrFileMap.get(query.category, \"balance_sheet\")\n\n        try:\n            results = await download_excel_file(url, query.use_cache)\n        except OpenBBError as e:\n            raise OpenBBError(f\"Error extracting data -> {e}\") from e\n\n        return {\"file\": results}\n\n    @staticmethod\n    def transform_data(\n        query: EiaPetroleumStatusReportQueryParams,\n        data: dict,\n        **kwargs: Any,\n    ) -> list[EiaPetroleumStatusReportData]:\n        \"\"\"Transform the data.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        import concurrent.futures  # noqa\n        import re\n        from functools import lru_cache\n        from numpy import nan\n        from pandas import Categorical, ExcelFile, concat, read_excel\n        from warnings import warn\n","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/eia/openbb_us_eia/models/petroleum_status_report.py#L110-L146","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the text after 'Error extracting data -> ' — it carries the underlying cause (403 key error, network error, etc.).","Verify and re-enter the EIA API key (obb.user.credentials.eia.api_key) and retry.","Retry with use_cache=False in case a cached failed response is being replayed.","If the URL itself 404s, the WpsrFileMap may need updating — check the provider repo for fixes."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    res = await obb.energy.petroleum_status_report(category=cat, table=tbl, provider='eia')\nexcept OpenBBError as e:\n    msg = str(e)\n    if 'api_key' in msg or '403' in msg:\n        raise RuntimeError('EIA API key missing/invalid — set obb.account.credentials') from e\n    if 'downloading' in msg:\n        await asyncio.sleep(5)\n        res = await obb.energy.petroleum_status_report(category=cat, table=tbl, provider='eia', use_cache=False)\n    else:\n        raise","preventionTips":["Configure and verify the EIA API key before first use","Parse the chained cause text after '->' to route handling","Pass use_cache=False on retries to avoid replaying a failed cached response"],"tags":["eia","petroleum-status-report","network","api-key","download"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}