{"record":{"id":"82bb7f4024cf4d22","repo":"OpenBB-finance/OpenBB","slug":"year-must-be-from-1959","errorCode":null,"errorMessage":"Year must be from 1959.","messagePattern":"Year must be from 1959\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/federal_reserve/openbb_federal_reserve/utils/fomc_documents.py","lineNumber":183,"sourceCode":"    Returns\n    -------\n    list[dict]\n        A list of dictionaries mapping FOMC documents to URLs.\n        Each dictionary contains the following:\n        - 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","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/federal_reserve/openbb_federal_reserve/utils/fomc_documents.py#L165-L201","documentation":"ValueError from the FOMC document utility: a year filter was supplied that is below 1959, the first year for which the historical FOMC document archive has records. It fires before any document loading, so it is purely input validation against the dataset's known coverage.","triggerScenarios":"Calling the FOMC documents helper with year=1958 or earlier (including year passed as a string like '1950', which still compares < 1959 after truthiness check ordering — note the string comparison quirk in the source).","commonSituations":"Historical research scripts looping over decades; passing 0 or placeholder values; off-by-one when computing year ranges.","solutions":["Use year >= 1959, or omit year to get all documents.","Clamp user-supplied years: year = max(year, 1959) if a default is acceptable.","Validate the year range in your UI/config before calling."],"exampleFix":"// before\nget_fomc_documents(year=1945)\n// after\nget_fomc_documents(year=max(1945, 1959))  # or omit year","handlingStrategy":"validation","validationCode":"year = int(year) if isinstance(year, str) else year\nif year is not None and year < 1959:\n    raise ValueError('FOMC documents start at 1959')  # fail early with your own message","typeGuard":"def is_valid_fomc_year(y) -> bool:\n    try:\n        return 1959 <= int(str(y).strip()) <= 2100\n    except ValueError:\n        return False","tryCatchPattern":null,"preventionTips":["Clamp or reject years outside 1959..current in your own layer","Convert string years to int before passing"],"tags":["openbb","fomc","validation","year-range"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}