{"record":{"id":"9d0e5a2750319130","repo":"OpenBB-finance/OpenBB","slug":"category-category-is-not-a-supported-choice-cho","errorCode":null,"errorMessage":"Category {category} is not a supported choice. Choose from {list(SURVEY_CATEGORY_MAP)}","messagePattern":"Category (.+?) is not a supported choice\\. Choose from (.+?)","errorType":"exception","errorClass":"EmptyDataError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/bls/openbb_bls/utils/helpers.py","lineNumber":257,"sourceCode":"    df = df.apply(lambda x: x.str.strip() if x.dtype == \"object\" else x)\n\n    return df.replace({\"''\": None, '\"\"': None, NA: None, \"nan\": None, nan: None})\n\n\nasync def download_category_series_ids(category) -> tuple[list, dict]:\n    \"\"\"Download all series ids for a category of survey, along with the code maps.\n    This should only be required for updating static files.\n    \"\"\"\n    # pylint: disable=import-outside-toplevel\n    from numpy import nan  # noqa\n    from openbb_core.provider.utils.errors import EmptyDataError\n    from openbb_bls.utils.constants import SURVEY_CATEGORY_MAP, SURVEY_NAMES\n\n    series_ids: list = []\n    series_codes: dict = {}\n\n    if category not in SURVEY_CATEGORY_MAP:\n        raise EmptyDataError(\n            f\"Category {category} is not a supported choice. Choose from {list(SURVEY_CATEGORY_MAP)}\"\n        )\n\n    async def get_all_series_ids(survey):\n        \"\"\"Get an asset in the FTP download folder of the two-letter survey code.\"\"\"\n        if survey in [\"ch\", \"cs\", \"fw\", \"is\", \"nw\", \"oe\", \"yy\"]:\n            return\n        data = await get_survey_asset(survey, \"series\")\n        for col in [\"series_title\", \"survey_name\"]:\n            if col not in data.columns:  # type: ignore\n                data.loc[:, col] = None  # type: ignore\n        codes = [d for d in data.columns if \"code\" in d and \"periodicity\" not in d]  # type: ignore\n        ids = data.get([\"series_id\", \"series_title\"] + codes).copy()  # type: ignore\n\n        if ids is None or ids.empty:\n            return\n\n        ids = ids.rename(columns={\"footnote_codes\": \"footnote_code\"})","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/bls/openbb_bls/utils/helpers.py#L239-L275","documentation":"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.","triggerScenarios":"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.","commonSituations":"Contributors regenerating static assets after editing openbb_bls/utils/constants.py; confusion between the two constants (SURVEY_CATEGORY_NAMES vs SURVEY_CATEGORY_MAP).","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"],"exampleFix":"# before\nids, codes = await download_category_series_ids('Employment Situation')  # EmptyDataError\n\n# after\nfrom openbb_bls.utils.constants import SURVEY_CATEGORY_MAP\nkey = next(k for k in SURVEY_CATEGORY_MAP if 'employment' in k)\nids, codes = await download_category_series_ids(key)","handlingStrategy":"validation","validationCode":"from openbb_bls.utils.constants import SURVEY_CATEGORY_MAP\n\ndef assert_valid_category(category: str) -> None:\n    assert category in SURVEY_CATEGORY_MAP, (\n        f'use one of {list(SURVEY_CATEGORY_MAP)}')","typeGuard":"from openbb_bls.utils.constants import SURVEY_CATEGORY_MAP\n\ndef is_valid_bls_category(cat: str) -> bool:\n    return cat in SURVEY_CATEGORY_MAP","tryCatchPattern":null,"preventionTips":["Derive category keys programmatically from SURVEY_CATEGORY_MAP, never hardcode","Keep a single source of truth for category names in your scripts"],"tags":["bls","maintenance","validation","constants"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}