{"record":{"id":"78fefeda3c28b3be","repo":"OpenBB-finance/OpenBB","slug":"asset-asset-not-found","errorCode":null,"errorMessage":"Asset '{asset}' not found.","messagePattern":"Asset '(.+?)' not found\\.","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/bls/openbb_bls/utils/helpers.py","lineNumber":385,"sourceCode":"    from importlib.resources import files\n    from pathlib import Path\n    from numpy import nan\n    from openbb_core.app.model.abstract.error import OpenBBError\n    from pandas import read_csv\n\n    if \".xz\" not in asset and \"series\" in asset:\n        asset = asset + \".xz\"\n    elif \".json\" not in asset and \"codes\" in asset:\n        asset = asset + \".json\"\n    elif \".json\" in asset or \".xz\" in asset:\n        pass\n    else:\n        raise OpenBBError(f\"Asset '{asset}' not supported. Expected .json or .xz file.\")\n\n    assets_path = Path(str(files(\"openbb_bls\").joinpath(\"assets\")))\n\n    if not os.path.exists(assets_path.joinpath(asset)):\n        raise OpenBBError(f\"Asset '{asset}' not found.\")\n\n    if asset.endswith(\".json\"):\n        with open(assets_path.joinpath(asset)) as f:\n            return json.load(f)\n    else:\n        with open(assets_path.joinpath(asset), \"rb\") as f:\n            df = read_csv(f, compression=\"xz\", low_memory=False, dtype=\"str\")\n        return df.replace({nan: None, \"nan\": None, \"''\": None}).dropna(\n            how=\"all\", axis=1\n        )\n\n\nasync def update_static_asset(category: str) -> None:\n    \"\"\"Update a static file assets with series IDs and code maps for a given category.\n    Do not use unless the static files in the assets folder require updating.\n    \"\"\"\n    # pylint: disable=import-outside-toplevel\n    import json  # noqa","sourceCodeStart":367,"sourceCodeEnd":403,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/bls/openbb_bls/utils/helpers.py#L367-L403","documentation":"Raised by the BLS asset loader when the normalized asset name (after auto-appending .xz/.json) does not exist under the packaged openbb_bls/assets directory. The extension check has already passed, so this strictly means 'file missing from the installed package'. It is an OpenBBError about packaging state, not about user query parameters.","triggerScenarios":"Requesting a survey asset for a category whose static file was never generated (e.g. 'oe_series.xz' - note the code explicitly skips downloading some surveys), or an installed openbb_bls version whose assets folder is incomplete/outdated relative to the code.","commonSituations":"Mixed-version installs (code newer than assets after a partial upgrade), editable installs missing built assets, or contributors referencing assets that the update script (update_survey_files) has not yet produced.","solutions":["Reinstall openbb_bls cleanly (pip install --force-reinstall openbb-bls) to restore the packaged assets","Run the maintenance helper update_survey_files() to regenerate missing category assets","Confirm the category actually ships a series file - some surveys are intentionally skipped","Check for typos in the asset base name"],"exampleFix":"# before\ndata = get_survey_asset('xx_series.xz')  # file never generated -> OpenBBError: not found\n\n# after\nfrom openbb_bls.utils.helpers import update_survey_files\n# regenerate assets, then:\ndata = get_survey_asset('cu_series.xz')","handlingStrategy":"validation","validationCode":"from importlib.resources import files\nfrom pathlib import Path\n\ndef asset_exists(asset: str) -> bool:\n    p = Path(str(files('openbb_bls').joinpath('assets')))\n    return p.joinpath(asset).exists()","typeGuard":"from importlib.resources import files\nfrom pathlib import Path\n\ndef asset_exists(asset: str) -> bool:\n    p = Path(str(files('openbb_bls').joinpath('assets')))\n    return p.joinpath(asset).exists()","tryCatchPattern":null,"preventionTips":["Reinstall openbb-bls when asset/code versions drift","Regenerate assets with the maintenance helper after pulling new code","Check existence before batch loops over categories"],"tags":["bls","assets","missing-file","packaging"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}