OpenBB-finance/OpenBB · error · ValueError

Measure {measure} not supported. Choose from 'value', 'equal

Error message

Measure {measure} not supported. Choose from 'value', 'equal', 'number_of_firms', or 'firm_size'.

What it means

Raised by the US research-portfolios helper when `measure` is not one of 'value', 'equal', 'number_of_firms', 'firm_size'. These correspond to the value-weighted/equal-weighted returns and the firm count / average size sheets in the Fama/French US datasets. Note: if the dataset name contains 'Factor', measure is silently ignored (set to None) instead of erroring.

Source

Thrown at openbb_platform/providers/famafrench/openbb_famafrench/utils/helpers.py:814

        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)

    if frequency:
        out_dfs = [
            df
            for df, meta in zip(dfs, metadata)

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Use one of 'value', 'equal', 'number_of_firms', 'firm_size'.
  2. Remember the international and US endpoints have different measure enums — do not share one dropdown.
  3. For Factor datasets any measure is ignored anyway; pick a research portfolios dataset to use measures.

Example fix

// before
obb.economy.famafrench.research_portfolios(measure='usd')

// after
obb.economy.famafrench.research_portfolios(measure='value')
Defensive patterns

Strategy: validation

Validate before calling

US_MEASURES = ('value', 'equal', 'number_of_firms', 'firm_size')
assert not measure or measure in US_MEASURES, f'measure must be one of {US_MEASURES}'

Type guard

def is_valid_us_measure(m: str | None) -> bool:
    return m is None or m in ('value', 'equal', 'number_of_firms', 'firm_size')

Prevention

When it happens

Trigger: Calling a US portfolio endpoint with measure='vw', 'weighted', or any token outside the four allowed values on a non-Factor dataset.

Common situations: Reusing the international endpoint's measure vocabulary ('usd'/'local'/'ratios') on the US endpoint; abbreviations from other data vendors.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/2c4d6d75d7e695cd. Report an issue: GitHub.