OpenBB-finance/OpenBB · error · ValueError
Index {index} not found in available indexes: {INTERNATIONAL
Error message
Index {index} not found in available indexes: {INTERNATIONAL_INDEX_PORTFOLIO_FILES} What it means
Raised by get_international_portfolio_data when the `index` argument is not a key in INTERNATIONAL_INDEX_PORTFOLIO_FILES. Note the f-string interpolates the variable AFTER it has been overwritten by the failed .get() — so the message shows 'Index None not found', a minor logging bug that hides the bad input value.
Source
Thrown at openbb_platform/providers/famafrench/openbb_famafrench/utils/helpers.py:540
Note: Not intended for direct use, this function is called by `get_international_portfolio`.
"""
# pylint: disable=import-outside-toplevel
import zipfile
from io import BytesIO
url: str = ""
data: str = ""
if not index and not country:
raise ValueError("Please provide either an index or a country.")
if index and country:
raise ValueError(
"Please provide either an index or a country, not both at the same time."
)
if index:
index = INTERNATIONAL_INDEX_PORTFOLIO_FILES.get(index)
if not index:
raise ValueError(
f"Index {index} not found in available indexes: "
+ f"{INTERNATIONAL_INDEX_PORTFOLIO_FILES}"
)
url = (
BASE_URL
+ INTERNATIONAL_INDEX_PORTFOLIOS_URLS["dividends" if dividends else "ex"]
)
if country:
country = country.title().replace("_", " ")
if country not in list(COUNTRY_PORTFOLIO_FILES):
raise ValueError(
f"Country {country} not found in available countries: "
+ f"{COUNTRY_PORTFOLIO_FILES}"
)
url = BASE_URL + COUNTRY_PORTFOLIOS_URLS["dividends" if dividends else "ex"]
index = COUNTRY_PORTFOLIO_FILES[country]
response = download_international_portfolios(url)View on GitHub (pinned to 3e071fcc2c)
Solutions
- Use an exact key from INTERNATIONAL_INDEX_PORTFOLIO_FILES in openbb_famafrench/utils/helpers.py (e.g. 'Developed', 'World').
- Ignore the 'Index None' text in the error body — your original value is what failed the lookup.
- Upgrade the provider if the index list changed upstream.
Example fix
// before obb.economy.famafrench.international_index_returns(index='developed') // after obb.economy.famafrench.international_index_returns(index='Developed')
Defensive patterns
Strategy: validation
Validate before calling
from openbb_famafrench.utils.helpers import INTERNATIONAL_INDEX_PORTFOLIO_FILES
if index and index not in INTERNATIONAL_INDEX_PORTFOLIO_FILES:
raise ValueError(f'{index!r} not in {list(INTERNATIONAL_INDEX_PORTFOLIO_FILES)}') Type guard
def is_valid_ff_index(index: str) -> bool:
from openbb_famafrench.utils.helpers import INTERNATIONAL_INDEX_PORTFOLIO_FILES
return index in INTERNATIONAL_INDEX_PORTFOLIO_FILES Prevention
- Populate dropdowns from INTERNATIONAL_INDEX_PORTFOLIO_FILES keys at startup.
- Note the error message shows 'Index None' due to variable overwrite — rely on your own validation, not the message.
When it happens
Trigger: Passing an index name that is not in the INTERNATIONAL_INDEX_PORTFOLIO_FILES mapping, e.g. 'developed' (wrong case) or a renamed index.
Common situations: Case-sensitive index labels; index names changed between provider versions; the misleading 'Index None' message leading developers to think the parameter was not sent.
Related errors
- The request was returned empty. This may be due to an invali
- Invalid region, '{region}', for factor '{factor}'. Only 'ame
- Invalid region: '{region}'. Valid regions are: {", ".join(FA
- Invalid factor: '{factor}' for region: '{region}'. Valid fac
- Invalid frequency: '{frequency}' for factor: '{factor}' in r
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/12deb5b414183d01.
Report an issue: GitHub.