OpenBB-finance/OpenBB · warning · OpenBBError
No data found for the specified port(s). {port_codes} Ensure
Error message
No data found for the specified port(s). {port_codes} Ensure the port_code is correct and available in the IMF PortWatch dataset. What it means
Raised at the end of the fetch step when every per-port call completed without exception but produced zero records (output list empty). The port codes were structurally valid and reachable; the API simply returned no rows. Typical causes are date windows outside the port's activity range, a port with no recorded daily activity, or a well-formed but non-existent port ID that the API accepts silently.
Source
Thrown at openbb_platform/providers/imf/openbb_imf/models/port_volume.py:451
if data:
output.extend(data)
except Exception as e:
raise OpenBBError(
f"Failed to fetch data for port {port_code}: {e} -> {e.args}"
) from e
tasks = [fetch_port_data(port_code=port_code) for port_code in port_codes]
tasks_results = await asyncio.gather(*tasks, return_exceptions=True)
for result in tasks_results:
if isinstance(result, Exception):
raise OpenBBError(
f"Error fetching port data: {result} -> {result.args[0]}"
)
if not output:
raise OpenBBError(
f"No data found for the specified port(s). {port_codes}"
" Ensure the port_code is correct and available in the IMF PortWatch dataset."
)
return output
@staticmethod
def transform_data(
query: ImfPortVolumeQueryParams,
data: list,
**kwargs: Any,
) -> list[ImfPortVolumeData]:
"""Transform the raw data into the model."""
return [
ImfPortVolumeData(**item)
for item in sorted(data, key=lambda x: (x.get("date"), x.get("portname")))
]
View on GitHub (pinned to 3e071fcc2c)
Solutions
- Widen or shift the date range (e.g. a full month around the target period) and retry.
- Confirm the port exists in the IMF PortWatch dataset and has activity in the requested window (check the port on the IMF PortWatch site or via the provider's port map).
- Verify the port_code string exactly (IDs are case-sensitive values like 'port1114').
Example fix
# before res = await obb.economy.port_volume(provider='imf', port_code='port9999', start_date='2026-08-01', end_date='2026-08-03') # after res = await obb.economy.port_volume(provider='imf', port_code='port1114', start_date='2025-01-01', end_date='2025-03-31')
Defensive patterns
Strategy: validation
Validate before calling
# before a narrow window, sanity-check that the window plausibly has activity
if end_date - start_date < timedelta(days=7):
start_date = end_date - timedelta(days=30) # widen window
res = await obb.economy.port_volume(provider='imf', port_code='port1114', start_date=start_date, end_date=end_date) Try / catch
try:
res = await obb.economy.port_volume(provider='imf', port_code=port, start_date=s, end_date=e)
except OpenBBError as e:
if 'No data found' in str(e):
return [] # expected for inactive ports / out-of-range windows
raise Prevention
- Treat empty results as a normal outcome, not a crash — this error is severity warning in practice.
- Verify port IDs against the PortWatch explorer once, cache the list.
- Avoid very short date windows for sparse ports.
When it happens
Trigger: start_date/end_date entirely after the last observation for a port; requesting a decommissioned or inactive port ID; weekend-only windows where no activity posted; port codes with wrong casing or typos that still pass local validation.
Common situations: Historical backtests with recent-only dates; ports known locally but not in the current PortWatch dataset; timezone/date-boundary mistakes producing one-day windows in a dead period.
Related errors
- Error serializing output for an extension-modified endpoint
- start_date must be after 2019-01-01 for IMF Port Volume data
- Expected values as valid portIDs, got None instead.
- Failed to fetch data for port {port_code}: {e} -> {e.args}
- No data returned for the given query parameters.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/d11aa839fa78f107.
Report an issue: GitHub.