{"record":{"id":"19f11ff3c632f0fd","repo":"blakeblackshear/frigate","slug":"invalid-model-url-only-hef-files-are-supported","errorCode":null,"errorMessage":"Invalid model URL. Only .hef files are supported.","messagePattern":"Invalid model URL\\. Only \\.hef files are supported\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"frigate/detectors/plugins/hailo8l.py","lineNumber":301,"sourceCode":"            or url.startswith(\"www.\")\n        )\n\n    @staticmethod\n    def extract_model_name(path: str = None, url: str = None) -> str:\n        if path and path.endswith(\".hef\"):\n            return os.path.basename(path)\n        elif url and url.endswith(\".hef\"):\n            return os.path.basename(url)\n        else:\n            if ARCH == \"hailo8\":\n                return H8_DEFAULT_MODEL\n            else:\n                return H8L_DEFAULT_MODEL\n\n    @staticmethod\n    def download_model(url: str, destination: str):\n        if not url.endswith(\".hef\"):\n            raise ValueError(\"Invalid model URL. Only .hef files are supported.\")\n        try:\n            urllib.request.urlretrieve(url, destination)\n            logger.debug(f\"Downloaded model to {destination}\")\n        except Exception as e:\n            raise RuntimeError(f\"Failed to download model from {url}: {str(e)}\") from e\n\n    def check_and_prepare(self) -> str:\n        if not os.path.exists(self.cache_dir):\n            os.makedirs(self.cache_dir)\n        model_name = self.extract_model_name(self.model_path, self.url)\n        cached_model_path = os.path.join(self.cache_dir, model_name)\n        if not self.model_path and not self.url:\n            if os.path.exists(cached_model_path):\n                logger.debug(f\"Model found in cache: {cached_model_path}\")\n                return cached_model_path\n            else:\n                logger.debug(f\"Downloading default model: {model_name}\")\n                if ARCH == \"hailo8\":","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/blakeblackshear/frigate/blob/ca18b8dc131ccb3e086f13a780853b775ef13426/frigate/detectors/plugins/hailo8l.py#L283-L319","documentation":"Hailo8L detector's download_model validates that the model URL ends with .hef, the Hailo Executable Format; anything else (a .onnx, .tar.gz, or an HTML page URL) is rejected before attempting a download. This is a config-input validation error, not a network error.","triggerScenarios":"Configuring the hailo8l detector with model.url pointing to a non-.hef file, e.g. an ONNX model from the Hailo model zoo instead of the compiled HEF, or a URL with query string appended after .hef (note: endswith check fails if URL has trailing params).","commonSituations":"Copying a Hailo Model Zoo ONNX link instead of the HEF link; pasting a redirect/GitHub page URL; URL with query parameters so it does not literally end with .hef.","solutions":["Use the direct URL to a compiled .hef file (Hailo Model Zoo HEF links)","Ensure the URL literally ends with .hef (no query string or fragment)","Alternatively download the .hef yourself and set model.path to the local file"],"exampleFix":"# before\nurl: https://hailo-model-zoo.s3.../yolov8n.onnx\n# after\nurl: https://hailo-csdata.../yolov8n.hef","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse\n\ndef is_valid_hef_url(url: str) -> bool:\n    p = urlparse(url)\n    return p.scheme in ('http','https') and os.path.basename(p.path).endswith('.hef')","typeGuard":null,"tryCatchPattern":"try:\n    HailoDetector.download_model(url, dest)\nexcept ValueError as e:\n    if 'Only .hef files' in str(e):\n        url = fix_url_to_hef(url)\n    raise","preventionTips":["Always link the compiled HEF artifact, not onnx/source","Avoid URLs with query strings after .hef","Consider pre-downloading and using local model.path"],"tags":["hailo","model-url","validation","hef"],"backgroundTag":"invalid-model-url-format","analyzedSha":"ca18b8dc131ccb3e086f13a780853b775ef13426","analyzedAt":"2026-08-27T11:28:05.618Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}