blakeblackshear/frigate · error · ValueError

Invalid model path: {self.memx_model_path}. Only .zip files

Error message

Invalid model path: {self.memx_model_path}. Only .zip files are supported. Please provide a .zip model archive.

What it means

MemryX detector only accepts custom models packaged as .zip archives; check_and_prepare_model validates the configured path suffix and rejects anything else (a bare .dfp, .onnx, or a directory) with ValueError before any extraction.

Source

Thrown at frigate/detectors/plugins/memryx.py:204

                f"Loaded MemryX model from {self.memx_model_path} and {self.memx_post_model}"
            )

        except Exception as e:
            logger.error(f"Failed to initialize MemryX model: {e}")
            raise

    def check_and_prepare_model(self):
        if not os.path.exists(self.cache_dir):
            os.makedirs(self.cache_dir, exist_ok=True)

        lock_path = os.path.join(self.cache_dir, f".{self.model_folder}.lock")
        lock = FileLock(lock_path, timeout=60)

        with lock:
            # ---------- CASE 1: user provided a custom model path ----------
            if self.memx_model_path:
                if not self.memx_model_path.endswith(".zip"):
                    raise ValueError(
                        f"Invalid model path: {self.memx_model_path}. "
                        "Only .zip files are supported. Please provide a .zip model archive."
                    )
                if not os.path.exists(self.memx_model_path):
                    raise FileNotFoundError(
                        f"Custom model zip not found: {self.memx_model_path}"
                    )

                logger.info(f"User provided zip model: {self.memx_model_path}")

                # Extract custom zip into a separate area so it never clashes with MemryX cache
                custom_dir = os.path.join(
                    self.cache_dir, "custom_models", self.model_folder
                )
                if os.path.isdir(custom_dir):
                    shutil.rmtree(custom_dir)
                os.makedirs(custom_dir, exist_ok=True)

View on GitHub (pinned to ca18b8dc13)

Solutions

  1. Package the compiled .dfp (plus *_post.onnx if the model type needs it) into a .zip and point the config at the zip
  2. Or use one of the bundled/downloadable MemryX model zips supported by the plugin
  3. Verify the exact configured path ends with .zip and exists inside the container

Example fix

# before
path: /models/yolov6s.dfp
# after
zip -r /models/yolov6s.zip /models/pkg/  # containing the .dfp
path: /models/yolov6s.zip
Defensive patterns

Strategy: validation

Validate before calling

import os

def is_valid_memryx_path(path: str | None) -> bool:
    return path is None or (path.endswith('.zip') and os.path.isfile(path))

Try / catch

try:
    detector = MemryXDetector(config)
except ValueError as e:
    if 'Only .zip files are supported' in str(e):
        raise SystemExit('Package the .dfp (+ *_post.onnx) as a .zip') from None
    raise

Prevention

When it happens

Trigger: Setting the memryx detector model path to a raw .dfp file, an .onnx, or a directory instead of the expected zip archive containing the .dfp (and optionally *_post.onnx).

Common situations: User points at a .dfp extracted from a previous run instead of the original zip; downloads an onnx/dfp from the model zoo directly; misunderstands that the plugin expects the packaged bundle.

Related errors


AI-assisted analysis of blakeblackshear/frigate@ca18b8dc13 (2026-08-27). Data as JSON: /api/errors/5f2570917922a6b2. Report an issue: GitHub.