{"record":{"id":"d11aa839fa78f107","repo":"OpenBB-finance/OpenBB","slug":"no-data-found-for-the-specified-port-s-port-cod","errorCode":null,"errorMessage":"No data found for the specified port(s). {port_codes} Ensure the port_code is correct and available in the IMF PortWatch dataset.","messagePattern":"No data found for the specified port\\(s\\)\\. (.+?) Ensure the port_code is correct and available in the IMF PortWatch dataset\\.","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"warning","filePath":"openbb_platform/providers/imf/openbb_imf/models/port_volume.py","lineNumber":451,"sourceCode":"                if data:\n                    output.extend(data)\n            except Exception as e:\n                raise OpenBBError(\n                    f\"Failed to fetch data for port {port_code}: {e} -> {e.args}\"\n                ) from e\n\n        tasks = [fetch_port_data(port_code=port_code) for port_code in port_codes]\n\n        tasks_results = await asyncio.gather(*tasks, return_exceptions=True)\n\n        for result in tasks_results:\n            if isinstance(result, Exception):\n                raise OpenBBError(\n                    f\"Error fetching port data: {result} -> {result.args[0]}\"\n                )\n\n        if not output:\n            raise OpenBBError(\n                f\"No data found for the specified port(s). {port_codes}\"\n                \" Ensure the port_code is correct and available in the IMF PortWatch dataset.\"\n            )\n        return output\n\n    @staticmethod\n    def transform_data(\n        query: ImfPortVolumeQueryParams,\n        data: list,\n        **kwargs: Any,\n    ) -> list[ImfPortVolumeData]:\n        \"\"\"Transform the raw data into the model.\"\"\"\n        return [\n            ImfPortVolumeData(**item)\n            for item in sorted(data, key=lambda x: (x.get(\"date\"), x.get(\"portname\")))\n        ]\n","sourceCodeStart":433,"sourceCodeEnd":468,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/imf/openbb_imf/models/port_volume.py#L433-L468","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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')."],"exampleFix":"# before\nres = await obb.economy.port_volume(provider='imf', port_code='port9999', start_date='2026-08-01', end_date='2026-08-03')\n\n# after\nres = await obb.economy.port_volume(provider='imf', port_code='port1114', start_date='2025-01-01', end_date='2025-03-31')","handlingStrategy":"validation","validationCode":"# before a narrow window, sanity-check that the window plausibly has activity\nif end_date - start_date < timedelta(days=7):\n    start_date = end_date - timedelta(days=30)  # widen window\nres = await obb.economy.port_volume(provider='imf', port_code='port1114', start_date=start_date, end_date=end_date)","typeGuard":null,"tryCatchPattern":"try:\n    res = await obb.economy.port_volume(provider='imf', port_code=port, start_date=s, end_date=e)\nexcept OpenBBError as e:\n    if 'No data found' in str(e):\n        return []  # expected for inactive ports / out-of-range windows\n    raise","preventionTips":["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."],"tags":["no-data","imf","ports","date-range","fetcher"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}