OpenBB-finance/OpenBB · error · OpenBBError
Minimum start_date is 2019-01-01. Got {values['start_date']}
Error message
Minimum start_date is 2019-01-01. Got {values['start_date']} instead. What it means
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.
Source
Thrown at openbb_platform/providers/imf/openbb_imf/models/port_volume.py:166
new_values.append(list(port_id_map.keys())[idx])
else:
raise ValueError(
f"Invalid port_code: {item}. Must be a valid port ID or name.Available options: {port_id_choices}."
)
if not new_values:
raise ValueError("No valid port_code provided.")
return ",".join(new_values)
@model_validator(mode="before")
@classmethod
def validate_model(cls, values):
"""Validate the model before instantiation."""
if values.get("start_date") is not None and values["start_date"] < dateType(
2019, 1, 1
):
raise OpenBBError(
ValueError(
f"Minimum start_date is 2019-01-01. Got {values['start_date']} instead."
)
)
if not values.get("port_code") and not values.get("country"):
values["port_code"] = "port1114"
return values
class ImfPortVolumeData(PortVolumeData):
"""IMF Port Volume Data Model."""
model_config = ConfigDict(
extra="ignore",
json_schema_extra={
"x-widget_config": {
"$.description": (View on GitHub (pinned to 3e071fcc2c)
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.
Example fix
# before
start = date(2015, 1, 1)
params = {'provider': 'imf', 'start_date': start}
# after
start = max(date(2015, 1, 1), date(2019, 1, 1)) # -> date(2019,1,1)
params = {'provider': 'imf', 'start_date': start} Defensive patterns
Strategy: validation
Validate before calling
from datetime import date
MIN_START = date(2019, 1, 1)
if start_date is not None and start_date < MIN_START:
start_date = MIN_START # or raise your own error
assert start_date is None or start_date >= MIN_START Try / catch
try:
res = await obb.economy.port_volume(provider='imf', start_date=start)
except OpenBBError as e:
if 'Minimum start_date is 2019-01-01' in str(e):
start = date(2019, 1, 1)
res = await obb.economy.port_volume(provider='imf', start_date=start) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- No valid port_code provided.
- start_date must be after 2019-01-01 for IMF Port Volume data
- Invalid transform value '{query.transform}' for dataflow '{d
- No indicators specified.
- Invalid chokepoint name: {chokepoint} -> Expected one of {li
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/ec822790f3b790b1.
Report an issue: GitHub.