OpenBB-finance/OpenBB · error · ValueError
Start date '{dt_start_date}' is after the last date availabl
Error message
Start date '{dt_start_date}' is after the last date available for Fama-French '{df.index[-1]}' What it means
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.
Source
Thrown at openbb_platform/extensions/quantitative/openbb_quantitative/helpers.py:53
skiprows=3,
)
df = df[df["Date"].apply(lambda x: len(str(x).strip()) == 6)]
df["Date"] = df["Date"].astype(str) + "01"
df["Date"] = to_datetime(df["Date"], format="%Y%m%d")
df["MKT-RF"] = to_numeric(df["MKT-RF"], downcast="float")
df["SMB"] = to_numeric(df["SMB"], downcast="float")
df["HML"] = to_numeric(df["HML"], downcast="float")
df["RF"] = to_numeric(df["RF"], downcast="float")
df["MKT-RF"] = df["MKT-RF"] / 100
df["SMB"] = df["SMB"] / 100
df["HML"] = df["HML"] / 100
df["RF"] = df["RF"] / 100
df = df.set_index("Date")
dt_start_date = to_datetime(start_date, format="%Y-%m-%d")
if dt_start_date > df.index.max():
raise ValueError(
f"Start date '{dt_start_date}' is after the last date available for Fama-French '{df.index[-1]}'"
)
df = df.loc[start_date:end_date] # type: ignore
return df
def validate_window(input_data: Union["Series", "DataFrame"], window: int) -> None:
"""Validate the window input.
Parameters
----------
input_data : Union[Series, DataFrame]
The input data to be validated.
window : int
The window to be validated.
View on GitHub (pinned to 3e071fcc2c)
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.
Example fix
# before res = obb.quantitative.fama_french(...) # start_date='2026-01-01', data ends 2025-12 # after res = obb.quantitative.fama_french(..., start_date='2025-01-01')
Defensive patterns
Strategy: validation
Validate before calling
from datetime import datetime
start = datetime.strptime(start_date, "%Y-%m-%d")
last = fama_french_df.index.max()
assert start <= last, f"start_date {start.date()} is after last available {last.date()}; use <= {last.date()}" Type guard
def start_within_data(start_date: str, df) -> bool:
from datetime import datetime
return datetime.strptime(start_date, "%Y-%m-%d") <= df.index.max() Try / catch
try:
res = obb.quantitative.fama_french(..., start_date=start_date)
except ValueError as e:
if "after the last date available" in str(e):
start_date = str(df.index.max().date()) # clamp to dataset end
res = obb.quantitative.fama_french(..., start_date=start_date)
else:
raise Prevention
- Check the dataset's latest date before requesting recent ranges
- Upgrade openbb-quantitative for fresher factor data
- Always use YYYY-MM-DD strings
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Window '{window}' is greater than the input data length '{le
- No data available for the requested time period. Data for th
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/5cb12b02b111de58.
Report an issue: GitHub.