{"record":{"id":"3791f45f513fd262","repo":"OpenBB-finance/OpenBB","slug":"year-must-be-an-integer","errorCode":null,"errorMessage":"Year must be an integer.","messagePattern":"Year must be an integer\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/federal_reserve/openbb_federal_reserve/utils/fomc_documents.py","lineNumber":188,"sourceCode":"        - date: str\n            The date of the document, formatted as YYYY-MM-DD.\n        - doc_type: str\n            The type of the document.\n        - doc_format: str\n            The format of the document.\n        - 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()","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/federal_reserve/openbb_federal_reserve/utils/fomc_documents.py#L170-L206","documentation":"ValueError from the same FOMC utility: year arrived as a string whose isdigit() check failed, so it was coerced to 0 and rejected. The utility accepts string years but only all-digit strings — anything with a sign, whitespace, decimal point, or letters becomes 0.","triggerScenarios":"Passing year='19_95', year=' 1995', year='1995.0', year='-1995', or year='FY1995' — any non-pure-digit string. Note this check runs after the 'year < 1959' comparison, so some malformed strings fail earlier instead.","commonSituations":"Web form or CLI input that forwards raw strings; years extracted from filenames or free text without normalization; locale-specific digit formats.","solutions":["Normalize before calling: strip whitespace and convert with int(year_str) inside your own try/except.","Pass an int when possible — the utility accepts both.","Reject non-numeric input client-side with a clear message."],"exampleFix":"// before\nget_fomc_documents(year=' 1995')\n// after\nget_fomc_documents(year=int(' 1995'.strip()))","handlingStrategy":"validation","validationCode":"year = int(str(year).strip())  # raises a clear ValueError here instead of inside the util","typeGuard":"def is_digit_year(s) -> bool:\n    return isinstance(s, str) and s.strip().isdigit()","tryCatchPattern":null,"preventionTips":["Never forward raw user strings as years; parse them yourself","Prefer passing int years"],"tags":["openbb","fomc","type-coercion","validation"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}