{"record":{"id":"9335e718c33bb269","repo":"roboflow/supervision","slug":"invalid-asset-it-should-be-one-of-the-following","errorCode":null,"errorMessage":"Invalid asset. It should be one of the following: {valid_assets}.","messagePattern":"Invalid asset\\. It should be one of the following: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/assets/downloader.py","lineNumber":137,"sourceCode":"                original_md5_hash=original_md5_hash,\n                destination=destination,\n                check_target=check_target,\n            )\n        else:\n            if not is_md5_hash_matching(check_target, original_md5_hash):\n                logger.warning(\"File corrupted. Re-downloading...\")\n                os.remove(check_target)\n                _download_verified_asset(\n                    filename=filename,\n                    original_md5_hash=original_md5_hash,\n                    destination=destination,\n                    check_target=check_target,\n                )\n\n            logger.info(\"%s asset download complete.\", filename)\n    else:\n        valid_assets = \", \".join(filename for filename in MEDIA_ASSETS.keys())\n        raise ValueError(\n            f\"Invalid asset. It should be one of the following: {valid_assets}.\"\n        )\n\n    return return_value\n","sourceCodeStart":119,"sourceCodeEnd":142,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/assets/downloader.py#L119-L142","documentation":"Raised by download_assets() when asset_name is neither a member of the Assets enum nor a key of the MEDIA_ASSETS dictionary. The downloader can only fetch assets it knows the URL and MD5 for, so unknown names are rejected up front with the list of valid options.","triggerScenarios":"Calling download_assets(\"video.mp4\") with a raw filename instead of Assets.ENCODED_VIDEO, or passing a typo like Assets.VIDEO, or an asset name string that was never registered in MEDIA_ASSETS.","commonSituations":"Copy-pasting asset filenames from docs/issues instead of the enum; supervision versions where the Assets enum gained/renamed members; user code written against a different fork with extra assets.","solutions":["Use the enum: from supervision.assets import Assets; download_assets(Assets.ENCODED_VIDEO, directory=...).","If you only have a string, pass the exact key from MEDIA_ASSETS — print supervision.assets.downloader.MEDIA_ASSETS.keys() to see valid names.","Check the installed supervision version's Assets members if the name came from newer/older docs."],"exampleFix":"// before\npath = download_assets(\"cctv-1080p.mp4\")\n\n// after\nfrom supervision.assets import Assets\npath = download_assets(Assets.ENCODED_VIDEO, directory=\"assets\")","handlingStrategy":"validation","validationCode":"from supervision.assets import Assets, downloader\nvalid = {a.value for a in Assets} | set(downloader.MEDIA_ASSETS)\nif isinstance(asset_name, str) and asset_name not in valid:\n    raise ValueError(f\"Unknown asset {asset_name!r}; valid: {sorted(valid)}\")\npath = download_assets(asset_name, directory=directory)","typeGuard":"def is_valid_asset(name) -> bool:\n    from supervision.assets import Assets, downloader\n    return name in {a.value for a in Assets} | set(downloader.MEDIA_ASSETS)","tryCatchPattern":null,"preventionTips":["Always use the Assets enum, never raw filenames.","If dependent on docs examples, verify the enum member exists in your installed supervision version.","Print Assets members after upgrading supervision."],"tags":["assets","download","invalid-argument","enum"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}