{"record":{"id":"5f2570917922a6b2","repo":"blakeblackshear/frigate","slug":"invalid-model-path-self-memx-model-path-only","errorCode":null,"errorMessage":"Invalid model path: {self.memx_model_path}. Only .zip files are supported. Please provide a .zip model archive.","messagePattern":"Invalid model path: (.+?)\\. Only \\.zip files are supported\\. Please provide a \\.zip model archive\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"frigate/detectors/plugins/memryx.py","lineNumber":204,"sourceCode":"                f\"Loaded MemryX model from {self.memx_model_path} and {self.memx_post_model}\"\n            )\n\n        except Exception as e:\n            logger.error(f\"Failed to initialize MemryX model: {e}\")\n            raise\n\n    def check_and_prepare_model(self):\n        if not os.path.exists(self.cache_dir):\n            os.makedirs(self.cache_dir, exist_ok=True)\n\n        lock_path = os.path.join(self.cache_dir, f\".{self.model_folder}.lock\")\n        lock = FileLock(lock_path, timeout=60)\n\n        with lock:\n            # ---------- CASE 1: user provided a custom model path ----------\n            if self.memx_model_path:\n                if not self.memx_model_path.endswith(\".zip\"):\n                    raise ValueError(\n                        f\"Invalid model path: {self.memx_model_path}. \"\n                        \"Only .zip files are supported. Please provide a .zip model archive.\"\n                    )\n                if not os.path.exists(self.memx_model_path):\n                    raise FileNotFoundError(\n                        f\"Custom model zip not found: {self.memx_model_path}\"\n                    )\n\n                logger.info(f\"User provided zip model: {self.memx_model_path}\")\n\n                # Extract custom zip into a separate area so it never clashes with MemryX cache\n                custom_dir = os.path.join(\n                    self.cache_dir, \"custom_models\", self.model_folder\n                )\n                if os.path.isdir(custom_dir):\n                    shutil.rmtree(custom_dir)\n                os.makedirs(custom_dir, exist_ok=True)\n","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/blakeblackshear/frigate/blob/ca18b8dc131ccb3e086f13a780853b775ef13426/frigate/detectors/plugins/memryx.py#L186-L222","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Package the compiled .dfp (plus *_post.onnx if the model type needs it) into a .zip and point the config at the zip","Or use one of the bundled/downloadable MemryX model zips supported by the plugin","Verify the exact configured path ends with .zip and exists inside the container"],"exampleFix":"# before\npath: /models/yolov6s.dfp\n# after\nzip -r /models/yolov6s.zip /models/pkg/  # containing the .dfp\npath: /models/yolov6s.zip","handlingStrategy":"validation","validationCode":"import os\n\ndef is_valid_memryx_path(path: str | None) -> bool:\n    return path is None or (path.endswith('.zip') and os.path.isfile(path))","typeGuard":null,"tryCatchPattern":"try:\n    detector = MemryXDetector(config)\nexcept ValueError as e:\n    if 'Only .zip files are supported' in str(e):\n        raise SystemExit('Package the .dfp (+ *_post.onnx) as a .zip') from None\n    raise","preventionTips":["Always package MemryX models as zips containing the .dfp","Include *_post.onnx for yolonas/ssd types","Keep the original distributed zip rather than re-zipping loose artifacts"],"tags":["memryx","model-path","validation","zip"],"backgroundTag":"invalid-model-file-format","analyzedSha":"ca18b8dc131ccb3e086f13a780853b775ef13426","analyzedAt":"2026-08-27T11:28:05.618Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}