{"record":{"id":"409da6bc346f2e32","repo":"OpenBB-finance/OpenBB","slug":"task-result","errorCode":null,"errorMessage":"{task_result}","messagePattern":"\\{task_result\\}","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/imf/openbb_imf/models/maritime_chokepoint_volume.py","lineNumber":336,"sourceCode":"                chokepoint_ids.append(CHOKEPOINTS_NAME_TO_ID[chokepoint])\n            elif chokepoint in CHOKEPOINTS_NAME_TO_ID.values() or chokepoint.startswith(\n                \"chokepoint\"\n            ):\n                chokepoint_ids.append(chokepoint)\n            else:\n                raise OpenBBError(\n                    f\"Invalid chokepoint name: {chokepoint}. Expected one of {list(CHOKEPOINTS_NAME_TO_ID.keys())}.\"\n                )\n\n        tasks = [\n            get_one(chokepoint_id) for chokepoint_id in chokepoint_ids if chokepoint_id\n        ]\n\n        task_results = await asyncio.gather(*tasks, return_exceptions=True)\n\n        for task_result in task_results:\n            if isinstance(task_result, Exception):\n                raise OpenBBError(task_result)\n\n        if not results:\n            raise OpenBBError(\"The response was returned empty with no error message.\")\n\n        return results\n\n    @staticmethod\n    def transform_data(\n        query: ImfMaritimeChokePointVolumeQueryParams,\n        data: list,\n        **kwargs: Any,\n    ) -> list[ImfMaritimeChokePointVolumeData]:\n        \"\"\"Validate and transform the raw data into the model.\"\"\"\n        return [ImfMaritimeChokePointVolumeData(**r) for r in data]\n","sourceCodeStart":318,"sourceCodeEnd":351,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/imf/openbb_imf/models/maritime_chokepoint_volume.py#L318-L351","documentation":"After `asyncio.gather(..., return_exceptions=True)` fans out per-chokepoint fetches, the first task result that is an Exception is re-raised as OpenBBError. The message is the inner exception's str — typically a network or HTTP error from one of the concurrent `get_daily_chokepoint_data` calls. One bad chokepoint fails the whole request.","triggerScenarios":"Requesting several chokepoints where at least one per-chokepoint request fails (timeout, 429 throttling from parallel ArcGIS hits, invalid id like 'chokepoint99' producing an HTTP error). Because gather collects exceptions, the raised message corresponds to whichever failed task is iterated first, not necessarily the first chronologically.","commonSituations":"Fan-out of many chokepoints triggering ArcGIS rate limits; one misspelled chokepointN id; flaky networks under concurrency.","solutions":["Inspect the message to identify which chokepoint/request failed; retry that one.","Reduce the number of simultaneous chokepoints or add your own rate limiting between calls.","Ensure every id is a real chokepointN (1..24) or canonical name.","Fetch chokepoints individually so one failure does not discard successful results."],"exampleFix":"# before\nmaritime_chokepoint_volume(chokepoint='Strait of Hormuz,Suez Canal,Panama Canal', start_date='2024-01-01')\n\n# after (per-chokepoint with individual error handling)\nfor cp in ['Strait of Hormuz', 'Suez Canal', 'Panama Canal']:\n    try:\n        res = await obb.economy.imf.maritime_chokepoint_volume(chokepoint=cp, start_date='2024-01-01')\n    except OpenBBError as e:\n        logger.warning('failed %s: %s', cp, e)","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"results = []\nfor cp in chokepoints:  # fetch sequentially/individually instead of one fan-out\n    try:\n        results += await fetch_one(cp)\n    except OpenBBError as e:\n        log.warning('chokepoint %s failed: %s', cp, e)","preventionTips":["Fetch chokepoints individually when partial results are acceptable","Throttle concurrent ArcGIS requests to avoid 429s failing the whole gather"],"tags":["imf","portwatch","concurrency","network","wrapper-exception"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}