OpenBB-finance/OpenBB · error · ValueError

Measure {measure} not supported. Choose from 'usd', 'local',

Error message

Measure {measure} not supported. Choose from 'usd', 'local', or 'ratios'.

What it means

Raised by get_international_portfolio_data when `measure` is not one of 'usd', 'local', 'ratios' (after lowercasing; None defaults to 'usd'). Note the check runs AFTER the data has already been downloaded and parsed, so an invalid measure wastes a full fetch before failing.

Source

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

    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.
    """
    measure = measure.lower() if measure is not None else "usd"
    data = get_international_portfolio_data(index, country, dividends)
    tables = read_dat_file(data)
    dataframes, metadata = process_international_portfolio_data(tables, dividends)

    if measure and measure not in ["usd", "local", "ratios"]:
        raise ValueError(
            f"Measure {measure} not supported. Choose from 'usd', 'local', or 'ratios'."
        )

    if frequency == "monthly" and measure == "ratios":
        raise ValueError("Only annual frequency is available for 'ratios' measure.")

    if frequency:
        dfs = [
            df
            for df, meta in zip(dataframes, metadata)
            if meta["frequency"] == frequency
        ]
        dfs_meta = [meta for meta in metadata if meta["frequency"] == frequency]
    else:
        dfs = dataframes
        dfs_meta = metadata

    if measure == "local":

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Use exactly 'usd', 'local', or 'ratios' (case-insensitive).
  2. Strip whitespace from user input before calling.
  3. Validate the value client-side first — the server only validates after downloading, so early validation saves a round trip.

Example fix

// before
obb.economy.famafrench.international_index_returns(country='Japan', measure='JPY')

// after
obb.economy.famafrench.international_index_returns(country='Japan', measure='local')
Defensive patterns

Strategy: validation

Validate before calling

measure = (measure or 'usd').strip().lower()
assert measure in ('usd', 'local', 'ratios'), f"measure must be usd|local|ratios, got {measure!r}"

Type guard

def is_valid_intl_measure(m: str) -> bool:
    return (m or 'usd').strip().lower() in ('usd', 'local', 'ratios')

Prevention

When it happens

Trigger: Calling international portfolio returns with measure='USD Returns', measure='euro', or any string outside the three allowed values.

Common situations: Assuming currency codes are accepted; passing user free-text input straight into the API; case is handled but whitespace is not (' usd' fails).

Related errors


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