{"record":{"id":"6e20e012017568d8","repo":"OpenBB-finance/OpenBB","slug":"year-must-not-be-before-1974","errorCode":null,"errorMessage":"Year must not be before 1974.","messagePattern":"Year must not be before 1974\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/government_us/openbb_government_us/models/weather_bulletin.py","lineNumber":27,"sourceCode":"from openbb_core.provider.standard_models.weather_bulletin import (\n    WeatherBulletinData,\n    WeatherBulletinQueryParams,\n)\nfrom pydantic import ConfigDict, field_validator\n\n\nclass GovernmentUsWeatherBulletinQueryParams(WeatherBulletinQueryParams):\n    \"\"\"US Government Weather Bulletin Query Params.\n\n    Source: https://esmis.nal.usda.gov/publication/weekly-weather-and-crop-bulletin\n    \"\"\"\n\n    @field_validator(\"year\")\n    @classmethod\n    def _validate_year(cls, value: int) -> int:\n        \"\"\"Validate year.\"\"\"\n        if value < 1974:\n            raise ValueError(\"Year must not be before 1974.\")\n        if value > datetime.now().year:\n            raise OpenBBError(ValueError(\"Invalid year. Year cannot be in the future.\"))\n        return value\n\n\nclass GovernmentUsWeatherBulletinData(WeatherBulletinData):\n    \"\"\"US Government Weather Bulletin Data.\n\n    The Weekly Weather and Crop Bulletin is released by 4:00 p.m. on the second workday of each week.\n\n    The Bulletin includes the National Summary, State Stories, current data for weather, temperature and precipitation\n    and international agricultural weather. The full report is jointly published by the National Oceanic\n    and Atmospheric Administration of the U.S. Department of Commerce, the National Agricultural Statistics Service,\n    and the World Agricultural Outlook Board.\n    \"\"\"\n\n    model_config = ConfigDict(\n        extra=\"ignore\",","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/government_us/openbb_government_us/models/weather_bulletin.py#L9-L45","documentation":"Pydantic field_validator on the WeatherBulletinQueryParams 'year' field rejects any year earlier than 1974, the first year the Weekly Weather and Crop Bulletin is available in the ESMIS archive. It is raised at parameter-validation time, before any network call, as a plain ValueError (pydantic surfaces it as a validation error).","triggerScenarios":"Calling the government_us weather_bulletin router with year=1973 or earlier (including accidentally passing 0 or a two-digit year like 74).","commonSituations":"Typo'd or default-initialized years (0, 1900); passing a two-digit year literal; analysts assuming longer history than the archive holds.","solutions":["Pass a year between 1974 and the current year.","If the value comes from user input, clamp or validate it to [1974, current_year] before calling."],"exampleFix":"# before\nres = obb.economy.gov.weather_bulletin(year=1971)\n\n# after\nres = obb.economy.gov.weather_bulletin(year=1975)","handlingStrategy":"validation","validationCode":"MIN_YEAR = 1974\n\ndef valid_bulletin_year(y: int) -> bool:\n    return MIN_YEAR <= y <= datetime.now().year","typeGuard":"def is_valid_bulletin_year(y: object) -> bool is not None and isinstance(y, int) and not isinstance(y, bool) and 1974 <= y <= datetime.now().year","tryCatchPattern":null,"preventionTips":["Clamp user-supplied years into [1974, current year].","Reject two-digit year input in your own form layer."],"tags":["validation","weather-bulletin","range-check"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}