{"record":{"id":"d5f1049770c75f2c","repo":"OpenBB-finance/OpenBB","slug":"invalid-document-type-must-be-one-of-join-d5f104","errorCode":null,"errorMessage":"Invalid document type. Must be one of: {', '.join(choice_types)}","messagePattern":"Invalid document type\\. Must be one of: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/federal_reserve/openbb_federal_reserve/utils/fomc_documents.py","lineNumber":194,"sourceCode":"        - url: str\n            The URL of the document\n    \"\"\"\n    filtered_docs: list[dict] = []\n    choice_types = list(getattr(FomcDocumentType, \"__args__\", ()))\n\n    if year and year < 1959:\n        raise ValueError(\"Year must be from 1959.\")\n\n    if year and isinstance(year, str):\n        year = int(year) if year.isdigit() else 0\n        if year == 0:\n            raise ValueError(\"Year must be an integer.\")\n\n    if not document_type:\n        document_type = \"all\"\n\n    if document_type not in choice_types:\n        raise ValueError(\n            f\"Invalid document type. Must be one of: {', '.join(choice_types)}\"\n        )\n\n    if year:\n        docs = (\n            get_current_fomc_documents()\n            if year > 2024\n            else load_historical_fomc_documents()\n        )\n    else:\n        current_docs = get_current_fomc_documents()\n        historical_docs = load_historical_fomc_documents()\n        docs = current_docs + historical_docs\n\n    for doc in docs:\n        doc_year = int(doc[\"date\"].split(\"-\")[0])\n        if year and doc_year != year:\n            continue","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/federal_reserve/openbb_federal_reserve/utils/fomc_documents.py#L176-L212","documentation":"ValueError raised when document_type is non-empty but not one of the FomcDocumentType Literal choices. The helper defaults empty/None to 'all', so this specifically means a wrong-typed value was supplied. The message lists the exact accepted choices.","triggerScenarios":"Passing document_type='minutes ' (trailing space — no strip is applied), 'agenda' vs 'agendas', wrong case like 'Minutes', or a type added/renamed in a newer provider version than the caller was written against.","commonSituations":"Hardcoded strings from older OpenBB versions after FomcDocumentType gained/renamed members; user input forwarded verbatim without normalization.","solutions":["Use one of the choices printed in the message, exactly as listed (case- and spelling-sensitive).","Derive allowed values programmatically from FomcDocumentType's args instead of hardcoding.","Lowercase/strip user input, then check membership before calling."],"exampleFix":"from typing import get_args\nfrom openbb_federal_reserve.utils.fomc_documents import FomcDocumentType\n# before\nget_fomc_documents(document_type='Minutes')\n# after\nchoices = [str(c) for c in get_args(FomcDocumentType)]\ndoc_type = 'Minutes'.strip().lower()\nassert doc_type in choices, f'use one of {choices}'","handlingStrategy":"validation","validationCode":"from typing import get_args\nfrom openbb_federal_reserve.utils.fomc_documents import FomcDocumentType\nchoices = [str(c) for c in get_args(FomcDocumentType)]\ndoc_type = (document_type or 'all').strip().lower()\nassert doc_type in choices, f'document_type must be one of {choices}'","typeGuard":"def is_valid_doc_type(v) -> bool:\n    from typing import get_args\n    from openbb_federal_reserve.utils.fomc_documents import FomcDocumentType\n    return (v or 'all') in [str(c) for c in get_args(FomcDocumentType)]","tryCatchPattern":null,"preventionTips":["Read choices from FomcDocumentType, not from memory","Normalize case/whitespace before validating"],"tags":["openbb","fomc","validation","document-type"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}