{"record":{"id":"f2fca847872dbca9","repo":"OpenBB-finance/OpenBB","slug":"attribute-must-be-a-string-or-list-of-strings-got","errorCode":null,"errorMessage":"Attribute must be a string or list of strings. Got {type(v)}","messagePattern":"Attribute must be a string or list of strings\\. Got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py","lineNumber":246,"sourceCode":"        if v and isinstance(v, list) and not v[0]:\n            return None\n\n        attributes = v\n\n        if isinstance(attributes, str):\n            attributes = (\n                [attributes] if \",\" not in attributes else attributes.split(\",\")\n            )\n\n        if (\n            isinstance(attributes, list)\n            and len(attributes) == 1\n            and \",\" in attributes[0]\n        ):\n            attributes = attributes[0].split(\",\")\n\n        if not isinstance(attributes, list):\n            raise ValueError(\n                f\"Attribute must be a string or list of strings. Got {type(v)}\"\n            )\n\n        invalid_attrs = [attr for attr in attributes if attr not in ATTRIBUTES]\n\n        if invalid_attrs:\n            raise ValueError(\n                f\"Invalid attribute(s) '{', '.join(invalid_attrs)}'. Valid attributes are: \"\n                + \", \".join(sorted(list(ATTRIBUTES)))\n            )\n\n        return attributes\n\n    @field_validator(\"country\", mode=\"before\", check_fields=False)\n    @classmethod\n    def _validate_country(cls, v):\n        \"\"\"Validate country.\"\"\"\n        if not v:","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py#L228-L264","documentation":"Error \"Attribute must be a string or list of strings. Got {type(v)}\" thrown in OpenBB-finance/OpenBB.","triggerScenarios":"Thrown at openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py:246 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the attribute as a string or a list of strings.","Remove any non-string items from the attribute list."],"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"}