OpenBB-finance/OpenBB · error · OpenBBError
Dates must be after 2022-04-03.
Error message
Dates must be after 2022-04-03.
What it means
EconDbPortVolumeQueryParams defines a field_validator on start_date/end_date that rejects any date earlier than 2022-04-04, raising OpenBBError('Dates must be after 2022-04-03.'). The EconDB shipping/port-volume dataset simply begins on 2022-04-04, so earlier dates are invalid by construction.
Source
Thrown at openbb_platform/providers/econdb/openbb_econdb/models/port_volume.py:26
from openbb_core.app.model.abstract.error import OpenBBError
from openbb_core.provider.abstract.fetcher import Fetcher
from openbb_core.provider.standard_models.port_volume import (
PortVolumeData,
PortVolumeQueryParams,
)
from openbb_core.provider.utils.errors import EmptyDataError
from pydantic import Field, field_validator
class EconDbPortVolumeQueryParams(PortVolumeQueryParams):
"""EconDB Port Volume Query Parameters."""
@field_validator("start_date", "end_date", mode="before", check_fields=False)
@classmethod
def validate_dates(cls, v):
"""Validate the dates."""
if v and v < datetime(2022, 4, 4).date():
raise OpenBBError(
"Dates must be after 2022-04-03.",
)
return v if v else None
class EconDbPortVolumeData(PortVolumeData):
"""EconDB Port Volume Data."""
export_dwell_time: float | None = Field(
default=None,
description="EconDB model estimate for the average number of days from when a container"
+ " enters the terminal gates until it is loaded on a vessel."
+ " High dwelling times can indicate vessel delays.",
)
import_dwell_time: float | None = Field(
default=None,
description="EconDB model estimate for the average number of days from when a container is discharged"
+ " from a vessel until it exits the terminal gates."View on GitHub (pinned to 3e071fcc2c)
Solutions
- Set start_date (and end_date) to 2022-04-04 or later.
- Omit the dates entirely to get the full available range.
- Branch per provider when sharing date params across providers in one script.
Example fix
# before obb.economy.port_volume(provider='econdb', start_date='2021-01-01') # after obb.economy.port_volume(provider='econdb', start_date='2022-04-04') # or omit start_date
Defensive patterns
Strategy: validation
Validate before calling
from datetime import date
ECONDB_PORT_MIN = date(2022, 4, 4)
if start_date and start_date < ECONDB_PORT_MIN:
start_date = ECONDB_PORT_MIN Try / catch
from openbb_core.app.model.obbject import OpenBBError
try:
res = obb.economy.port_volume(provider='econdb', start_date=s)
except OpenBBError as e:
if 'must be after 2022-04-03' in str(e):
s = date(2022, 4, 4)
res = obb.economy.port_volume(provider='econdb', start_date=s)
else:
raise Prevention
- Per-provider date clamping in shared multi-provider code.
- Omit dates when full history is acceptable.
- Document dataset start dates per provider in your config.
When it happens
Trigger: Calling economy.port_volume(provider='econdb', start_date='2020-01-01') (or any date < 2022-04-04) — the error fires at parameter validation time, before any HTTP request.
Common situations: Reusing a generic default start_date (e.g. 5 years back) from a multi-provider workflow where other providers have longer history; copy-pasting date ranges from other endpoints.
Related errors
- No data found for the provided dates. Data has a range from
- Year must be 1935 or later.
- Start and end dates must be in the same Congress session.
- No valid countries were supplied.
- No valid countries were supplied.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/e42dbbeb2ec4c021.
Report an issue: GitHub.