OpenBB-finance/OpenBB · error · OpenBBError
Failed to fetch data: {response.status}
Error message
Failed to fetch data: {response.status} What it means
Raised during paginated fetching of the ports database: when `exceededTransferLimit` forces follow-up requests with `resultOffset`, any paginated request returning non-200 aborts with this status-only error. The full ports table exceeds one ArcGIS transfer, so this path runs on essentially every successful initial fetch.
Source
Thrown at openbb_platform/providers/imf/openbb_imf/models/port_info.py:260
async with await session.get(all_ports_url) as response:
if response.status != 200:
raise OpenBBError(
f"Failed to fetch data: {response.status} -> {response.reason}"
)
data = await response.json()
if "features" in data:
output.extend(data["features"])
if "exceededTransferLimit" in data:
while data.get("exceededTransferLimit"):
offset = len(output)
url = f"{all_ports_url}&resultOffset={offset}"
async with await session.get(url) as response:
if response.status != 200:
raise OpenBBError(
f"Failed to fetch data: {response.status}"
)
data = await response.json()
if "features" in data:
output.extend(data["features"])
return sorted(
output,
key=lambda x: x["attributes"]["vessel_count_total"],
reverse=True,
)
except Exception as e:
raise OpenBBError(e) from e
@staticmethod
def transform_data(View on GitHub (pinned to 3e071fcc2c)
Solutions
- Retry the call — a fresh run restarts pagination from offset 0.
- Space out full-table requests or cache the result locally instead of re-pulling.
- Filter server-side where possible (country/port_code filters reduce pages needed in transform, though fetch still pulls all).
- If persistent, check ArcGIS status and provider updates.
Defensive patterns
Strategy: retry
Try / catch
try:
ports = await obb.economy.imf.port_info()
except OpenBBError as e:
if 'Failed to fetch data' in str(e):
await asyncio.sleep(10)
ports = await obb.economy.imf.port_info() # restarts pagination from 0
else:
raise Prevention
- Persist port_info results to avoid repeated multi-page pulls
- Space out scheduled pulls of the full ports table
When it happens
Trigger: The initial all-ports query succeeds but a later page request fails mid-pagination: throttling kicked in between pages (429), transient 5xx on page 2+, or the service dropped the session. The work done so far is discarded.
Common situations: Repeated full-table pulls in quick succession hitting ArcGIS limits; slow networks where multi-page fetches are more likely to hit an intermittent failure.
Related errors
- Failed to fetch data: {response.status}
- Failed to fetch data: {response.status} -> {response.reason}
- Failed to fetch ports data: {response.status} - {response.re
- No data found in the response.
- {e}
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/cfd6cf151f89970d.
Report an issue: GitHub.