blakeblackshear/frigate · error · ValueError
Invalid model URL. Only .hef files are supported.
Error message
Invalid model URL. Only .hef files are supported.
What it means
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.
Source
Thrown at frigate/detectors/plugins/hailo8l.py:301
or url.startswith("www.")
)
@staticmethod
def extract_model_name(path: str = None, url: str = None) -> str:
if path and path.endswith(".hef"):
return os.path.basename(path)
elif url and url.endswith(".hef"):
return os.path.basename(url)
else:
if ARCH == "hailo8":
return H8_DEFAULT_MODEL
else:
return H8L_DEFAULT_MODEL
@staticmethod
def download_model(url: str, destination: str):
if not url.endswith(".hef"):
raise ValueError("Invalid model URL. Only .hef files are supported.")
try:
urllib.request.urlretrieve(url, destination)
logger.debug(f"Downloaded model to {destination}")
except Exception as e:
raise RuntimeError(f"Failed to download model from {url}: {str(e)}") from e
def check_and_prepare(self) -> str:
if not os.path.exists(self.cache_dir):
os.makedirs(self.cache_dir)
model_name = self.extract_model_name(self.model_path, self.url)
cached_model_path = os.path.join(self.cache_dir, model_name)
if not self.model_path and not self.url:
if os.path.exists(cached_model_path):
logger.debug(f"Model found in cache: {cached_model_path}")
return cached_model_path
else:
logger.debug(f"Downloading default model: {model_name}")
if ARCH == "hailo8":View on GitHub (pinned to ca18b8dc13)
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
Example fix
# before url: https://hailo-model-zoo.s3.../yolov8n.onnx # after url: https://hailo-csdata.../yolov8n.hef
Defensive patterns
Strategy: validation
Validate before calling
from urllib.parse import urlparse
def is_valid_hef_url(url: str) -> bool:
p = urlparse(url)
return p.scheme in ('http','https') and os.path.basename(p.path).endswith('.hef') Try / catch
try:
HailoDetector.download_model(url, dest)
except ValueError as e:
if 'Only .hef files' in str(e):
url = fix_url_to_hef(url)
raise Prevention
- Always link the compiled HEF artifact, not onnx/source
- Avoid URLs with query strings after .hef
- Consider pre-downloading and using local model.path
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Failed to download model from {url}: {str(e)}
- Model does not support detector type of {detector}
- Model file not found at: {self.model_path}
- HailoRT inference thread has stopped, restart required.
- Invalid model path: {self.memx_model_path}. Only .zip files
AI-assisted analysis of blakeblackshear/frigate@ca18b8dc13 (2026-08-27).
Data as JSON: /api/errors/19f11ff3c632f0fd.
Report an issue: GitHub.