OpenBB-finance/OpenBB · error · OpenBBError

{e}

Error message

{e}

What it means

Catch-all in `afetch_data` of the chokepoint volume fetcher: when no chokepoint is specified, it calls `get_all_daily_chokepoint_activity_data` for the full 24-chokepoint dataset and any exception (network failure, HTTP error, parse error) is re-wrapped as OpenBBError with the original as `__cause__`. The message is whatever the inner exception str is.

Source

Thrown at openbb_platform/providers/imf/openbb_imf/models/maritime_chokepoint_volume.py:302

        import asyncio  # noqa
        from openbb_imf.utils.port_watch_helpers import (
            get_daily_chokepoint_data,
            get_all_daily_chokepoint_activity_data,
        )

        chokepoints = (
            query.chokepoint
            if isinstance(query.chokepoint, list)
            else query.chokepoint.split(",") if query.chokepoint else []
        )

        if not chokepoints:
            try:
                return await get_all_daily_chokepoint_activity_data(
                    start_date=query.start_date, end_date=query.end_date
                )
            except Exception as e:
                raise OpenBBError(e) from e

        results: list = []

        async def get_one(chokepoint_id):
            """Get data for a single chokepoint."""
            data = await get_daily_chokepoint_data(
                chokepoint_id, query.start_date, query.end_date
            )
            if data:
                results.extend(data)

        # Accept both keys and values from CHOKEPOINTS_NAME_TO_ID
        chokepoint_ids: list = []
        for chokepoint in chokepoints:
            if chokepoint in CHOKEPOINTS_NAME_TO_ID:
                chokepoint_ids.append(CHOKEPOINTS_NAME_TO_ID[chokepoint])
            elif chokepoint in CHOKEPOINTS_NAME_TO_ID.values() or chokepoint.startswith(
                "chokepoint"

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Read the wrapped cause (`e.__cause__`) for the true failure — it may be a timeout, 429, or DNS error.
  2. Retry, possibly with a narrower start_date/end_date to shrink the bulk download.
  3. Specify explicit chokepoints to switch to the per-chokepoint endpoint, which is lighter than the bulk fetch.
  4. Verify network egress to the PortWatch/ArcGIS hosts.
Defensive patterns

Strategy: retry

Try / catch

try:
    data = await obb.economy.imf.maritime_chokepoint_volume(start_date=s, end_date=e)
except OpenBBError as e:
    cause = e.__cause__ or e
    if is_transient(cause):  # timeout / 429 / connection reset
        await asyncio.sleep(backoff())
        data = await obb.economy.imf.maritime_chokepoint_volume(start_date=s, end_date=e)
    else:
        raise

Prevention

When it happens

Trigger: Calling maritime_chokepoint_volume without `chokepoint` while the PortWatch/ArcGIS bulk endpoint fails: timeouts, non-200 status inside the helper, TLS errors, or JSON decode failures on a truncated response.

Common situations: Bulk historical pulls (the no-chokepoint path downloads a lot) hitting ArcGIS throttling or a slow connection that times out; running in sandboxes with restricted egress to services9.arcgis.com or portwatch.imf.org.

Related errors


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