{"record":{"id":"303f1bfa71d54428","repo":"OpenBB-finance/OpenBB","slug":"failed-to-fetch-data-for-chokepoint-id-e","errorCode":null,"errorMessage":"Failed to fetch data for {chokepoint_id}: {e}","messagePattern":"Failed to fetch data for (.+?): (.+?)","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/imf/openbb_imf/utils/port_watch_helpers.py","lineNumber":216,"sourceCode":"@alru_cache(maxsize=1)\nasync def get_all_daily_chokepoint_activity_data(\n    start_date: str | None = None, end_date: str | None = None\n) -> list:\n    \"\"\"Get the complete historical volume dataset for all chokepoints.\"\"\"\n    # pylint: disable=import-outside-toplevel\n    import asyncio  # noqa\n    from openbb_core.app.model.abstract.error import OpenBBError\n\n    chokepoints = [f\"chokepoint{i}\" for i in range(1, 25)]\n    chokepoints_data: list = []\n\n    async def _get_one_chokepoint_data(chokepoint_id):\n        \"\"\"Get the daily chokepoint data for a specific chokepoint.\"\"\"\n        try:\n            data = await get_daily_chokepoint_data(chokepoint_id, start_date, end_date)\n            chokepoints_data.extend(data)\n        except Exception as e:\n            raise OpenBBError(f\"Failed to fetch data for {chokepoint_id}: {e}\") from e\n\n    try:\n        gather_results = await asyncio.gather(\n            *[_get_one_chokepoint_data(cp) for cp in chokepoints],\n            return_exceptions=True,\n        )\n\n        for result in gather_results:\n            if isinstance(result, (OpenBBError, Exception)):\n                raise result\n\n        if not chokepoints_data:\n            raise OpenBBError(\"All requests were returned empty.\")\n\n        return chokepoints_data\n\n    except Exception as e:\n        raise OpenBBError(","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/imf/openbb_imf/utils/port_watch_helpers.py#L198-L234","documentation":"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.","triggerScenarios":"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.","commonSituations":"One degraded ArcGIS shard affecting a single chokepoint id; timeouts on wide date ranges; rate limiting hit by the 24-way concurrency burst.","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."],"exampleFix":"# before\ndata = await get_all_chokepoints_data(start_date, end_date)\n\n# after\nfor attempt in range(3):\n    try:\n        data = await get_all_chokepoints_data(start_date, end_date)\n        break\n    except OpenBBError as e:\n        if attempt == 2:\n            raise\n        await asyncio.sleep(5 * (attempt + 1))","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    data = await get_all_chokepoints_data(start, end)\nexcept OpenBBError as e:\n    if 'Failed to fetch data for chokepoint' in str(e):\n        # one shard failed transiently; retry whole sweep once or twice\n        raise Retryable(str(e)) from e\n    raise","preventionTips":["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."],"tags":["imf","port-watch","chokepoints","asyncio","network"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}