{"record":{"id":"14c0acbbdf95bd3c","repo":"OpenBB-finance/OpenBB","slug":"invalid-document-type-must-be-one-of-join","errorCode":null,"errorMessage":"Invalid document type. Must be one of: {', '.join(choice_types)}","messagePattern":"Invalid document type\\. Must be one of: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/federal_reserve/openbb_federal_reserve/models/fomc_documents.py","lineNumber":80,"sourceCode":"            }\n        },\n    }\n\n    year: int | None = Field(\n        default=None,\n        description=\"The year of FOMC documents to retrieve. If None, all years since 1959 are returned.\",\n    )\n    document_type: str | None = Field(\n        default=None,\n        description=f\"Filter by document type. Default is all. Choose from: {', '.join(choice_types)}\",\n    )\n\n    @field_validator(\"document_type\", mode=\"before\", check_fields=False)\n    @classmethod\n    def _validate_doc_type(cls, v):\n        \"\"\"Validate document type.\"\"\"\n        if v and v not in choice_types:\n            raise ValueError(\n                f\"Invalid document type. Must be one of: {', '.join(choice_types)}\"\n            )\n        return v\n\n\nclass FederalReserveFomcDocumentsData(Data):\n    \"\"\"Federal Reserve FOMC Documents Data.\"\"\"\n\n    model_config = ConfigDict(\n        json_schema_extra={\n            \"x-widget_config\": {\n                \"$.type\": \"multi_file_viewer\",\n                \"$.name\": \"FOMC PDF Document Viewer\",\n                \"$.description\": \"Current and historical FOMC PDF materials.\",\n                \"$.gridData\": {\n                    \"w\": 30,\n                    \"h\": 27,\n                },","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/federal_reserve/openbb_federal_reserve/models/fomc_documents.py#L62-L98","documentation":"Raised by a pydantic field_validator on FederalReserveFomcDocumentsQueryParams when document_type is non-null and not in choice_types (the FOMC document categories: agenda, minutes, statement, press_conference, etc.). Validation happens at query-model construction, before any fetch.","triggerScenarios":"Calling obb.economy.fed.fomc_documents (or the federal_reserve fomc_documents model) with document_type='minutes_pdf', 'Minutes' (wrong form), or another unsupported token.","commonSituations":"Guessing document type names; using display labels ('Press Conference') instead of the snake_case tokens; version drift if choice_types gained/lost entries.","solutions":["Read the choice_types list at the top of openbb_federal_reserve/models/fomc_documents.py and use an exact token.","Leave document_type as None to fetch all types, then filter client-side by the returned type field.","Use the token exactly as exposed in the endpoint's OpenAPI choices."],"exampleFix":"// before\nobb.economy.fomc_documents(document_type='Minutes')\n\n// after\nobb.economy.fomc_documents(document_type='minutes')","handlingStrategy":"validation","validationCode":"from openbb_federal_reserve.models.fomc_documents import choice_types\nif document_type and document_type not in choice_types:\n    raise ValueError(f'document_type must be one of {choice_types}')","typeGuard":"def is_valid_fomc_doc_type(t: str) -> bool:\n    from openbb_federal_reserve.models.fomc_documents import choice_types\n    return t in choice_types","tryCatchPattern":null,"preventionTips":["Import choice_types from the model module instead of hardcoding the list.","Use snake_case tokens exactly as defined; display labels like 'Minutes' are rejected."],"tags":["federal-reserve","fomc","validation","pydantic"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}