{"record":{"id":"5143539fa558d92d","repo":"OpenBB-finance/OpenBB","slug":"invalid-country-code-s-invalid-countries-val","errorCode":null,"errorMessage":"Invalid country code(s) '{invalid_countries}'. Valid country codes are: {valid_country_codes}","messagePattern":"Invalid country code\\(s\\) '(.+?)'\\. Valid country codes are: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py","lineNumber":292,"sourceCode":"\n        if not isinstance(countries, list):\n            raise ValueError(\n                f\"Country must be a string or list of strings. Got {type(v)}\"\n            )\n\n        if isinstance(countries, list) and len(countries) == 1 and \",\" in countries[0]:\n            countries = countries[0].split(\",\")\n\n        invalid_countries = [\n            country\n            for country in countries\n            if country\n            and country not in COUNTRY_CHOICES.values()\n            and country not in COUNTRY_CHOICES\n        ]\n\n        if invalid_countries:\n            raise ValueError(\n                f\"Invalid country code(s) '{', '.join(invalid_countries)}'. Valid country codes are: \"\n                + \", \".join(\n                    sorted(list(COUNTRY_CHOICES)),\n                )\n            )\n\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):","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py#L274-L310","documentation":"Error \"Invalid country code(s) '{invalid_countries}'. Valid country codes are: {valid_country_codes}\" thrown in OpenBB-finance/OpenBB.","triggerScenarios":"Thrown at openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py:292 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose country codes from the listed valid country codes.","Use the correct ISO-style codes expected by the PSD dataset."],"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-15T17:31:12.345Z"}