{"record":{"id":"ec822790f3b790b1","repo":"OpenBB-finance/OpenBB","slug":"minimum-start-date-is-2019-01-01-got-values-sta","errorCode":null,"errorMessage":"Minimum start_date is 2019-01-01. Got {values['start_date']} instead.","messagePattern":"Minimum start_date is 2019-01-01\\. Got (.+?) instead\\.","errorType":"validation","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/imf/openbb_imf/models/port_volume.py","lineNumber":166,"sourceCode":"                new_values.append(list(port_id_map.keys())[idx])\n            else:\n                raise ValueError(\n                    f\"Invalid port_code: {item}. Must be a valid port ID or name.Available options: {port_id_choices}.\"\n                )\n\n        if not new_values:\n            raise ValueError(\"No valid port_code provided.\")\n\n        return \",\".join(new_values)\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def validate_model(cls, values):\n        \"\"\"Validate the model before instantiation.\"\"\"\n        if values.get(\"start_date\") is not None and values[\"start_date\"] < dateType(\n            2019, 1, 1\n        ):\n            raise OpenBBError(\n                ValueError(\n                    f\"Minimum start_date is 2019-01-01. Got {values['start_date']} instead.\"\n                )\n            )\n        if not values.get(\"port_code\") and not values.get(\"country\"):\n            values[\"port_code\"] = \"port1114\"\n\n        return values\n\n\nclass ImfPortVolumeData(PortVolumeData):\n    \"\"\"IMF Port Volume Data Model.\"\"\"\n\n    model_config = ConfigDict(\n        extra=\"ignore\",\n        json_schema_extra={\n            \"x-widget_config\": {\n                \"$.description\": (","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/imf/openbb_imf/models/port_volume.py#L148-L184","documentation":"Raised by the model_validator(mode='before') on ImfPortVolumeQueryParams because the IMF PortWatch (DPL) daily port activity dataset only starts on 2019-01-01. Any non-None start_date earlier than that date is rejected up front rather than silently returning empty data. The supplied date is echoed back in the message.","triggerScenarios":"obb.economy.port_volume(provider='imf', start_date='2018-06-01') or any datetime.date before 2019-01-01 passed to the IMF port volume router; also reusing a global default start_date (e.g. 5 years back from today when today is before 2024) configured for other providers.","commonSituations":"Notebooks that set a fixed historical window; date pickers with no min-date constraint; switching an existing script from another provider (e.g. another source with longer history) to provider='imf' without adjusting dates.","solutions":["Set start_date to 2019-01-01 or later (or omit it entirely to accept the provider default).","Clamp the requested window: start_date = max(requested_start, date(2019,1,1)).","If older data is required, use a different provider for port activity; IMF PortWatch cannot serve pre-2019 data."],"exampleFix":"# before\nstart = date(2015, 1, 1)\nparams = {'provider': 'imf', 'start_date': start}\n\n# after\nstart = max(date(2015, 1, 1), date(2019, 1, 1))  # -> date(2019,1,1)\nparams = {'provider': 'imf', 'start_date': start}","handlingStrategy":"validation","validationCode":"from datetime import date\nMIN_START = date(2019, 1, 1)\nif start_date is not None and start_date < MIN_START:\n    start_date = MIN_START  # or raise your own error\nassert start_date is None or start_date >= MIN_START","typeGuard":null,"tryCatchPattern":"try:\n    res = await obb.economy.port_volume(provider='imf', start_date=start)\nexcept OpenBBError as e:\n    if 'Minimum start_date is 2019-01-01' in str(e):\n        start = date(2019, 1, 1)\n        res = await obb.economy.port_volume(provider='imf', start_date=start)","preventionTips":["Clamp requested start dates to date(2019,1,1) before any IMF port call.","Set min=2019-01-01 on date pickers bound to this endpoint.","Remember the floor applies to the model validator AND the fetcher — no code path accepts earlier dates."],"tags":["validation","date-bounds","imf","ports","query-params"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}