{"record":{"id":"4864e69034f78225","repo":"OpenBB-finance/OpenBB","slug":"failed-to-fetch-data-response-status-respon","errorCode":null,"errorMessage":"Failed to fetch data: {response.status} -> {response.reason}","messagePattern":"Failed to fetch data: (.+?) -> (.+?)","errorType":"http","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/imf/openbb_imf/models/port_info.py","lineNumber":244,"sourceCode":"        credentials: dict[str, str] | None,\n        **kwargs: Any,\n    ) -> list:\n        \"\"\"Extract the raw data from the IMF Port Watch API.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from openbb_core.provider.utils.helpers import get_async_requests_session\n\n        all_ports_url = (\n            \"https://services9.arcgis.com/weJ1QsnbMYJlCHdG/arcgis/rest/services/PortWatch_ports_database/FeatureServer/0/query?\"\n            + \"where=1%3D1&outFields=*&returnGeometry=false&outSR=&f=json\"\n        )\n        try:\n            output: list = []\n            data: dict = {}\n\n            async with await get_async_requests_session() as session:\n                async with await session.get(all_ports_url) as response:\n                    if response.status != 200:\n                        raise OpenBBError(\n                            f\"Failed to fetch data: {response.status} -> {response.reason}\"\n                        )\n\n                    data = await response.json()\n\n                if \"features\" in data:\n                    output.extend(data[\"features\"])\n\n                    if \"exceededTransferLimit\" in data:\n                        while data.get(\"exceededTransferLimit\"):\n                            offset = len(output)\n                            url = f\"{all_ports_url}&resultOffset={offset}\"\n\n                            async with await session.get(url) as response:\n                                if response.status != 200:\n                                    raise OpenBBError(\n                                        f\"Failed to fetch data: {response.status}\"\n                                    )","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/imf/openbb_imf/models/port_info.py#L226-L262","documentation":"Raised by the IMF port_info fetcher when the initial request to the PortWatch ports database ArcGIS FeatureServer (all-ports query) returns a non-200 status. Includes both the status code and reason phrase to aid diagnosis. Any subsequent exception in the fetch is re-wrapped by the outer handler as OpenBBError.","triggerScenarios":"GET to services9.arcgis.com PortWatch_ports_database FeatureServer returning 4xx/5xx: service outage, throttling (429), changed layer, or blocked egress.","commonSituations":"ArcGIS Online incidents; proxies/firewalls blocking services9.arcgis.com; heavy polling triggering ArcGIS rate limits; stale provider version pointing at a retired service URL.","solutions":["Retry after a delay; transient ArcGIS errors are common.","Open the FeatureServer URL in a browser/curl to confirm the service is alive and the layer schema unchanged.","Update the openbb_imf provider to the latest version in case the URL moved.","Ensure network egress to services9.arcgis.com is permitted."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    try:\n        ports = await obb.economy.imf.port_info()\n        break\n    except OpenBBError as e:\n        msg = str(e)\n        if 'Failed to fetch data' in msg and attempt < 2:\n            await asyncio.sleep(2 ** attempt)\n        else:\n            raise","preventionTips":["Cache the ports database locally; it changes rarely","Back off on 429 rather than hammering ArcGIS"],"tags":["imf","portwatch","arcgis","network","http-status"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}