OpenBB-finance/OpenBB · error · EmptyDataError
Category {category} is not a supported choice. Choose from {
Error message
Category {category} is not a supported choice. Choose from {list(SURVEY_CATEGORY_MAP)} What it means
Raised by download_category_series_ids (a BLS maintenance helper used to refresh the static asset files) when the requested category key is not in SURVEY_CATEGORY_MAP. The function is only needed when regenerating openbb_bls assets, and the error is a guard against typos in the category argument. It is an EmptyDataError raised before any download starts.
Source
Thrown at openbb_platform/providers/bls/openbb_bls/utils/helpers.py:257
df = df.apply(lambda x: x.str.strip() if x.dtype == "object" else x)
return df.replace({"''": None, '""': None, NA: None, "nan": None, nan: None})
async def download_category_series_ids(category) -> tuple[list, dict]:
"""Download all series ids for a category of survey, along with the code maps.
This should only be required for updating static files.
"""
# pylint: disable=import-outside-toplevel
from numpy import nan # noqa
from openbb_core.provider.utils.errors import EmptyDataError
from openbb_bls.utils.constants import SURVEY_CATEGORY_MAP, SURVEY_NAMES
series_ids: list = []
series_codes: dict = {}
if category not in SURVEY_CATEGORY_MAP:
raise EmptyDataError(
f"Category {category} is not a supported choice. Choose from {list(SURVEY_CATEGORY_MAP)}"
)
async def get_all_series_ids(survey):
"""Get an asset in the FTP download folder of the two-letter survey code."""
if survey in ["ch", "cs", "fw", "is", "nw", "oe", "yy"]:
return
data = await get_survey_asset(survey, "series")
for col in ["series_title", "survey_name"]:
if col not in data.columns: # type: ignore
data.loc[:, col] = None # type: ignore
codes = [d for d in data.columns if "code" in d and "periodicity" not in d] # type: ignore
ids = data.get(["series_id", "series_title"] + codes).copy() # type: ignore
if ids is None or ids.empty:
return
ids = ids.rename(columns={"footnote_codes": "footnote_code"})View on GitHub (pinned to 3e071fcc2c)
Solutions
- Inspect list(SURVEY_CATEGORY_MAP) in openbb_bls/utils/constants.py and pass an exact key
- Use the same casing as the map keys (usually lowercase)
- If you intended a display-name lookup, use the function keyed on SURVEY_CATEGORY_NAMES instead
- Update constants.py first if you added a new category
Example fix
# before
ids, codes = await download_category_series_ids('Employment Situation') # EmptyDataError
# after
from openbb_bls.utils.constants import SURVEY_CATEGORY_MAP
key = next(k for k in SURVEY_CATEGORY_MAP if 'employment' in k)
ids, codes = await download_category_series_ids(key) Defensive patterns
Strategy: validation
Validate before calling
from openbb_bls.utils.constants import SURVEY_CATEGORY_MAP
def assert_valid_category(category: str) -> None:
assert category in SURVEY_CATEGORY_MAP, (
f'use one of {list(SURVEY_CATEGORY_MAP)}') Type guard
from openbb_bls.utils.constants import SURVEY_CATEGORY_MAP
def is_valid_bls_category(cat: str) -> bool:
return cat in SURVEY_CATEGORY_MAP Prevention
- Derive category keys programmatically from SURVEY_CATEGORY_MAP, never hardcode
- Keep a single source of truth for category names in your scripts
When it happens
Trigger: Calling download_category_series_ids(category='CPI') when the map keys are lowercase slugs like 'cpi'; passing a category name from SURVEY_CATEGORY_NAMES instead of the map key; running the asset-update script with a stale constant file after categories were renamed.
Common situations: Contributors regenerating static assets after editing openbb_bls/utils/constants.py; confusion between the two constants (SURVEY_CATEGORY_NAMES vs SURVEY_CATEGORY_MAP).
Related errors
- Category '{category}' not found. Choose from {list(SURVEY_CA
- No results found for the provided query.
- Asset '{asset}' not supported. Expected .json or .xz file.
- Failed to download {category} -> {e}
- At least one extension type must be selected.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/9d0e5a2750319130.
Report an issue: GitHub.