{"record":{"id":"a5f1fa99a1456604","repo":"OpenBB-finance/OpenBB","slug":"expenditure-e-is-not-a-valid-choice-valid-cho","errorCode":null,"errorMessage":"Expenditure '{e}' is not a valid choice. Valid choices:\n\n{expenditure_choices}","messagePattern":"Expenditure '(.+?)' is not a valid choice\\. Valid choices:\n\n(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/imf/openbb_imf/models/consumer_price_index.py","lineNumber":370,"sourceCode":"            else:\n                raise ValueError(\n                    f\"Country '{v}' is not a valid IMF country code (ISO3) or country name.\"\n                )\n\n        return \",\".join(result)\n\n    @field_validator(\"expenditure\", mode=\"before\", check_fields=False)\n    @classmethod\n    def validate_expenditure(cls, v):\n        \"\"\"Validate expenditure.\"\"\"\n        expenditures = v.replace(\" \", \"_\").split(\",\")\n        new_expenditures: list[str] = []\n        for e in expenditures:\n            if (\n                e.lower() not in expenditure_choices\n                and e.upper() not in expenditure_dict_rev\n            ):\n                raise ValueError(\n                    f\"Expenditure '{e}' is not a valid choice. Valid choices:\\n\\n{expenditure_choices}\"\n                )\n            new_expenditures.append(e.lower())\n        return \",\".join(new_expenditures)\n\n\nclass ImfConsumerPriceIndexData(ConsumerPriceIndexData):\n    \"\"\"IMF CPI Data Model.\"\"\"\n\n    unit: str = Field(\n        description=\"Unit of measurement.\",\n    )\n    unit_multiplier: int | float = Field(\n        description=\"Unit multiplier for the observation value.\",\n    )\n    country_code: str = Field(\n        description=\"ISO3 country code.\",\n    )","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/imf/openbb_imf/models/consumer_price_index.py#L352-L388","documentation":"Error \"Expenditure '{e}' is not a valid choice. Valid choices:\n\n{expenditure_choices}\" thrown in OpenBB-finance/OpenBB.","triggerScenarios":"Thrown at openbb_platform/providers/imf/openbb_imf/models/consumer_price_index.py:370 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose an expenditure from the listed valid choices.","Omit the expenditure parameter to use the default."],"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"}