{"record":{"id":"5cb12b02b111de58","repo":"OpenBB-finance/OpenBB","slug":"start-date-dt-start-date-is-after-the-last-dat","errorCode":null,"errorMessage":"Start date '{dt_start_date}' is after the last date available for Fama-French '{df.index[-1]}'","messagePattern":"Start date '(.+?)' is after the last date available for Fama-French '(.+?)'","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/quantitative/openbb_quantitative/helpers.py","lineNumber":53,"sourceCode":"                    skiprows=3,\n                )\n\n    df = df[df[\"Date\"].apply(lambda x: len(str(x).strip()) == 6)]\n    df[\"Date\"] = df[\"Date\"].astype(str) + \"01\"\n    df[\"Date\"] = to_datetime(df[\"Date\"], format=\"%Y%m%d\")\n    df[\"MKT-RF\"] = to_numeric(df[\"MKT-RF\"], downcast=\"float\")\n    df[\"SMB\"] = to_numeric(df[\"SMB\"], downcast=\"float\")\n    df[\"HML\"] = to_numeric(df[\"HML\"], downcast=\"float\")\n    df[\"RF\"] = to_numeric(df[\"RF\"], downcast=\"float\")\n    df[\"MKT-RF\"] = df[\"MKT-RF\"] / 100\n    df[\"SMB\"] = df[\"SMB\"] / 100\n    df[\"HML\"] = df[\"HML\"] / 100\n    df[\"RF\"] = df[\"RF\"] / 100\n    df = df.set_index(\"Date\")\n\n    dt_start_date = to_datetime(start_date, format=\"%Y-%m-%d\")\n    if dt_start_date > df.index.max():\n        raise ValueError(\n            f\"Start date '{dt_start_date}' is after the last date available for Fama-French '{df.index[-1]}'\"\n        )\n\n    df = df.loc[start_date:end_date]  # type: ignore\n\n    return df\n\n\ndef validate_window(input_data: Union[\"Series\", \"DataFrame\"], window: int) -> None:\n    \"\"\"Validate the window input.\n\n    Parameters\n    ----------\n    input_data : Union[Series, DataFrame]\n        The input data to be validated.\n    window : int\n        The window to be validated.\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/quantitative/openbb_quantitative/helpers.py#L35-L71","documentation":"Thrown in the Fama-French helper (openbb_quantitative/helpers.py) after loading the factor dataset: the user-supplied start_date (parsed as %Y-%m-%d) is later than the maximum date in the loaded Fama-French index. This guards df.loc[start_date:end_date] from producing an empty slice.","triggerScenarios":"Calling the Fama-French based quantitative endpoints with a start_date after the newest row of the packaged/downloaded factor file (df.index.max()), e.g. requesting data from a date beyond the dataset's last update.","commonSituations":"Stale local Fama-French dataset behind the installed OpenBB version; requesting current-year dates when the packaged data ends earlier; date strings not matching YYYY-MM-DD causing unexpected parsed values.","solutions":["Set start_date to a date on or before the dataset's last available date shown in the message.","Update the Fama-French dataset / upgrade openbb-quantitative so the packaged file is current.","Format dates strictly as YYYY-MM-DD strings.","If you need recent factors, fetch the latest files from the Fama-French library and supply them through the supported data path."],"exampleFix":"# before\nres = obb.quantitative.fama_french(...)  # start_date='2026-01-01', data ends 2025-12\n\n# after\nres = obb.quantitative.fama_french(..., start_date='2025-01-01')","handlingStrategy":"validation","validationCode":"from datetime import datetime\nstart = datetime.strptime(start_date, \"%Y-%m-%d\")\nlast = fama_french_df.index.max()\nassert start <= last, f\"start_date {start.date()} is after last available {last.date()}; use <= {last.date()}\"","typeGuard":"def start_within_data(start_date: str, df) -> bool:\n    from datetime import datetime\n    return datetime.strptime(start_date, \"%Y-%m-%d\") <= df.index.max()","tryCatchPattern":"try:\n    res = obb.quantitative.fama_french(..., start_date=start_date)\nexcept ValueError as e:\n    if \"after the last date available\" in str(e):\n        start_date = str(df.index.max().date())  # clamp to dataset end\n        res = obb.quantitative.fama_french(..., start_date=start_date)\n    else:\n        raise","preventionTips":["Check the dataset's latest date before requesting recent ranges","Upgrade openbb-quantitative for fresher factor data","Always use YYYY-MM-DD strings"],"tags":["fama-french","date-validation","quantitative","data-limits"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}