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
- 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.
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
- 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
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
- Error downloading the file from the EIA site -> {e}
- Error fetching data from the EIA API -> {e}
- 'all' is not a supported choice for {category}. Please choos
- Invalid table choice: {table}. Valid choices for {category}:
- Expected an ExcelFile object, got {type(file)} instead.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/fccc8d1cd2cc10fc.
Report an issue: GitHub.