OpenBB-finance/OpenBB · error · ValueError
Either 'report_id' or 'commodity' must be provided. If both
Error message
Either 'report_id' or 'commodity' must be provided. If both are provided, 'commodity' takes precedence.
What it means
Error "Either 'report_id' or 'commodity' must be provided. If both are provided, 'commodity' takes precedence." thrown in OpenBB-finance/OpenBB.
Source
Thrown at openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py:316
return v
@field_validator("start_year", mode="before", check_fields=False)
@classmethod
def _validate_start_year(cls, v):
"""Validate start_year."""
if v and v < 1960:
raise ValueError("Earliest possible year is 1960.")
return v
@model_validator(mode="after")
def _validate_model(self):
"""Validate that start_year is less than or equal to end_year."""
report_id = getattr(self, "report_id", None)
commodity = getattr(self, "commodity", None)
if not report_id and not commodity:
raise ValueError(
"Either 'report_id' or 'commodity' must be provided."
+ " If both are provided, 'commodity' takes precedence."
)
return self
class GovernmentUsCommodityPsdData(CommodityPsdData):
"""US Government Commodity PSD Data."""
model_config = ConfigDict(
json_schema_extra={
"x-widget_config": {
"$.name": "USDA FAS Commodity Production Supply & Distribution Data",
"$.description": "Predefined presentation tables, or time series data by commodity."
+ " Source: USDA Foreign Agricultural Service (FAS) Production Supply & Distribution Online.",
"$.source": ["USDA", "FAS"],
"$.category": "Commodity",View on GitHub (pinned to 3e071fcc2c)
Solutions
- Provide either 'report_id' or 'commodity' in the query.
- If both are given, note that 'commodity' takes precedence.
When it happens
Trigger: Thrown at openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py:316 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/747b31e361af251b.
Report an issue: GitHub.