OpenBB-finance/OpenBB · error · ValueError
Frequency {frequency} not supported. Choose from 'monthly',
Error message
Frequency {frequency} not supported. Choose from 'monthly', 'annual', or 'daily'. What it means
Raised by the US research-portfolios helper when `frequency` (after lowercasing) is not 'monthly', 'annual', or 'daily'. Plain client-side validation performed before any download, unlike the international variant.
Source
Thrown at openbb_platform/providers/famafrench/openbb_famafrench/utils/helpers.py:810
If None, defaults to 'monthly'.
measure : Optional[str]
The measure of the data to return.
Can be 'value', 'equal', 'number_of_firms', or 'firm_size'.
If None, defaults to 'value'.
Returns
-------
tuple
A tuple containing a list of pandas DataFrames and a list of metadata dictionaries.
In most scenarios, there will only be 1 DataFrame and 1 metadata dictionary.
Raises
------
ValueError
When an invalid combination of parameters or unsupported values are supplied.
"""
if frequency and frequency.lower() not in ["monthly", "annual", "daily"]:
raise ValueError(
f"Frequency {frequency} not supported. Choose from 'monthly', 'annual', or 'daily'."
)
if measure and measure not in ["value", "equal", "number_of_firms", "firm_size"]:
raise ValueError(
f"Measure {measure} not supported. "
+ "Choose from 'value', 'equal', 'number_of_firms', or 'firm_size'."
)
if measure in ["number_of_firms", "firm_size"] and frequency == "annual":
raise ValueError(
f"Measure '{measure}' is only available for monthly frequency."
)
if "Factor" in dataset:
measure = None
file = download_file(dataset)
table, desc = read_csv_file(file)
dfs, metadata = process_csv_tables(table, desc)
View on GitHub (pinned to 3e071fcc2c)
Solutions
- Use 'monthly', 'annual', or 'daily' only.
- Normalize frequency strings (lowercase, strip) in your own layer before calling.
- Check the endpoint's OpenAPI parameter choices for the accepted enum.
Example fix
// before obb.economy.famafrench.us_portfolio_returns(frequency='quarterly') // after obb.economy.famafrench.us_portfolio_returns(frequency='annual')
Defensive patterns
Strategy: validation
Validate before calling
freq = (frequency or '').strip().lower()
assert freq in ('monthly', 'annual', 'daily'), f'unsupported frequency: {frequency!r}' Type guard
def is_valid_ff_frequency(f: str) -> bool:
return (f or '').strip().lower() in ('monthly', 'annual', 'daily') Prevention
- Map external frequency vocabularies (FRED Q/M/W codes) to these three tokens in an adapter layer.
- Drive user choices from the endpoint's OpenAPI enum rather than free text.
When it happens
Trigger: Calling a US portfolio famafrench endpoint with frequency='weekly', 'quarterly', 'M', or any other token.
Common situations: Mapping another API's frequency vocabulary (Q/W/M from FRED-style codes) onto this endpoint; user free-text passed through unvalidated.
Related errors
- Invalid frequency: '{frequency}' for factor: '{factor}' in r
- Only annual frequency is available for 'ratios' measure.
- Measure '{measure}' is only available for monthly frequency.
- Chart not found.
- The request was returned empty. This may be due to an invali
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/6af8809d331afdff.
Report an issue: GitHub.