OpenBB-finance/OpenBB · error · OpenBBError
Failed to fetch data for {chokepoint_id}: {e}
Error message
Failed to fetch data for {chokepoint_id}: {e} What it means
Wrapper inside the all-chokepoints fetcher: one of the 24 concurrent per-chokepoint tasks (chokepoint1..chokepoint24) raised while fetching its daily data, and that failure is re-raised as OpenBBError with the chokepoint id and cause. Because asyncio.gather uses return_exceptions=True, the exception surfaces only in the post-loop inspection, then gets re-raised here.
Source
Thrown at openbb_platform/providers/imf/openbb_imf/utils/port_watch_helpers.py:216
@alru_cache(maxsize=1)
async def get_all_daily_chokepoint_activity_data(
start_date: str | None = None, end_date: str | None = None
) -> list:
"""Get the complete historical volume dataset for all chokepoints."""
# pylint: disable=import-outside-toplevel
import asyncio # noqa
from openbb_core.app.model.abstract.error import OpenBBError
chokepoints = [f"chokepoint{i}" for i in range(1, 25)]
chokepoints_data: list = []
async def _get_one_chokepoint_data(chokepoint_id):
"""Get the daily chokepoint data for a specific chokepoint."""
try:
data = await get_daily_chokepoint_data(chokepoint_id, start_date, end_date)
chokepoints_data.extend(data)
except Exception as e:
raise OpenBBError(f"Failed to fetch data for {chokepoint_id}: {e}") from e
try:
gather_results = await asyncio.gather(
*[_get_one_chokepoint_data(cp) for cp in chokepoints],
return_exceptions=True,
)
for result in gather_results:
if isinstance(result, (OpenBBError, Exception)):
raise result
if not chokepoints_data:
raise OpenBBError("All requests were returned empty.")
return chokepoints_data
except Exception as e:
raise OpenBBError(View on GitHub (pinned to 3e071fcc2c)
Solutions
- Retry — single-chokepoint failures are usually transient; a second invocation typically succeeds.
- Narrow the date range if timeouts are the cause ({e} will show the underlying error).
- If one specific chokepoint id always fails, fetch the other 23 individually and skip it.
Example fix
# before
data = await get_all_chokepoints_data(start_date, end_date)
# after
for attempt in range(3):
try:
data = await get_all_chokepoints_data(start_date, end_date)
break
except OpenBBError as e:
if attempt == 2:
raise
await asyncio.sleep(5 * (attempt + 1)) Defensive patterns
Strategy: retry
Try / catch
try:
data = await get_all_chokepoints_data(start, end)
except OpenBBError as e:
if 'Failed to fetch data for chokepoint' in str(e):
# one shard failed transiently; retry whole sweep once or twice
raise Retryable(str(e)) from e
raise Prevention
- Expect single-chokepoint failures in 24-way concurrent sweeps; build retry in.
- Check the named chokepoint id in the message to spot consistently-broken shards.
When it happens
Trigger: Any of get_daily_chokepoint_data('chokepointN', start, end) failing — non-200 status, JSON decode failure, or timeout — during the concurrent sweep; note the shared chokepoints_data list is not rolled back, so partial results may already be appended.
Common situations: One degraded ArcGIS shard affecting a single chokepoint id; timeouts on wide date ranges; rate limiting hit by the 24-way concurrency burst.
Related errors
- Failed to fetch data: {response.status}
- All requests were returned empty.
- Error in fetching chokepoint data: {e} -> {e.args[0]}
- Error fetching data from the EIA API -> {e}
- Failed to fetch data: {response.status}
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/303f1bfa71d54428.
Report an issue: GitHub.