{"record":{"id":"747b31e361af251b","repo":"OpenBB-finance/OpenBB","slug":"either-report-id-or-commodity-must-be-provided","errorCode":null,"errorMessage":"Either 'report_id' or 'commodity' must be provided. If both are provided, 'commodity' takes precedence.","messagePattern":"Either 'report_id' or 'commodity' must be provided\\. If both are provided, 'commodity' takes precedence\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py","lineNumber":316,"sourceCode":"\n        return v\n\n    @field_validator(\"start_year\", mode=\"before\", check_fields=False)\n    @classmethod\n    def _validate_start_year(cls, v):\n        \"\"\"Validate start_year.\"\"\"\n        if v and v < 1960:\n            raise ValueError(\"Earliest possible year is 1960.\")\n        return v\n\n    @model_validator(mode=\"after\")\n    def _validate_model(self):\n        \"\"\"Validate that start_year is less than or equal to end_year.\"\"\"\n        report_id = getattr(self, \"report_id\", None)\n        commodity = getattr(self, \"commodity\", None)\n\n        if not report_id and not commodity:\n            raise ValueError(\n                \"Either 'report_id' or 'commodity' must be provided.\"\n                + \" If both are provided, 'commodity' takes precedence.\"\n            )\n\n        return self\n\n\nclass GovernmentUsCommodityPsdData(CommodityPsdData):\n    \"\"\"US Government Commodity PSD Data.\"\"\"\n\n    model_config = ConfigDict(\n        json_schema_extra={\n            \"x-widget_config\": {\n                \"$.name\": \"USDA FAS Commodity Production Supply & Distribution Data\",\n                \"$.description\": \"Predefined presentation tables, or time series data by commodity.\"\n                + \" Source: USDA Foreign Agricultural Service (FAS) Production Supply & Distribution Online.\",\n                \"$.source\": [\"USDA\", \"FAS\"],\n                \"$.category\": \"Commodity\",","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py#L298-L334","documentation":"Error \"Either 'report_id' or 'commodity' must be provided. If both are provided, 'commodity' takes precedence.\" thrown in OpenBB-finance/OpenBB.","triggerScenarios":"Thrown at openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py:316 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide either 'report_id' or 'commodity' in the query.","If both are given, note that 'commodity' takes precedence."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}