{"record":{"id":"5afef6975dce3dc2","repo":"mudler/LocalAI","slug":"no-detector-taskname-detection-found-in-pack","errorCode":null,"errorMessage":"no detector (taskname='detection') found in {pack_dir}","messagePattern":"no detector \\(taskname='detection'\\) found in (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"backend/python/insightface/engines.py","lineNumber":299,"sourceCode":"                skipped.append((os.path.basename(onnx_file), str(err)))\n                continue\n            if m is None:\n                skipped.append((os.path.basename(onnx_file), \"unknown taskname\"))\n                continue\n            # First occurrence of each taskname wins (matches FaceAnalysis).\n            if m.taskname not in self.models:\n                self.models[m.taskname] = m\n\n        if skipped:\n            import sys\n            print(\n                f\"[insightface] skipped {len(skipped)} non-pack ONNX file(s) in {pack_dir}: \"\n                + \", \".join(f\"{n} ({why})\" for n, why in skipped),\n                file=sys.stderr,\n            )\n\n        if \"detection\" not in self.models:\n            raise ValueError(f\"no detector (taskname='detection') found in {pack_dir}\")\n        self.det_model = self.models[\"detection\"]\n\n        self.det_model.prepare(0, input_size=self.det_size, det_thresh=self.det_thresh)\n        for name, m in self.models.items():\n            if name != \"detection\":\n                m.prepare(0)\n\n    def _faces(self, img: np.ndarray) -> list[Any]:\n        \"\"\"Run detection + all non-detection models per face.\"\"\"\n        if self.det_model is None:\n            return []\n        from insightface.app.common import Face\n\n        bboxes, kpss = self.det_model.detect(img, max_num=0)\n        if bboxes is None or bboxes.shape[0] == 0:\n            return []\n        faces: list[Any] = []\n        for i in range(bboxes.shape[0]):","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/python/insightface/engines.py#L281-L317","documentation":"Raised by the insightface engine constructor after loading all pack ONNX models: none of them reported taskname 'detection'. The detector (e.g. det_10g.onnx) is mandatory — without it no faces can be located for downstream recognition/embedding models — so the engine refuses to start.","triggerScenarios":"The pack directory's detector ONNX was skipped (its model_zoo.get_model call failed and landed in the `skipped` list — check the stderr skip notice), the manifest scoping excluded it, or a recognition-only model set was installed without any detector.","commonSituations":"Corrupt or version-incompatible det_*.onnx that fails inside model_zoo.get_model while other models load; a partial pack missing the detector file; or mixing standalone recognition models into a directory the engine treats as a full pack.","solutions":["Check stderr for the '[insightface] skipped ... non-pack ONNX file(s)' line — it names each skipped file and why; the detector is usually listed there.","Reinstall the full pack so a known-good det_*.onnx is present.","Verify the detector file matches the pack manifest name (det_10g.onnx for buffalo_l) and is not filtered out by _KNOWN_PACK_MANIFESTS.","Ensure onnxruntime is compatible with the pack's ONNX opset (an opset mismatch makes get_model raise and the detector get skipped)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import glob, os\ndetectors = [f for f in glob.glob(os.path.join(pack_dir, \"*.onnx\"))\n             if os.path.basename(f).startswith(\"det_\")]\nassert detectors, f\"no detector ONNX in {pack_dir}; pack incomplete\"","typeGuard":"def pack_has_detector(pack_dir: str) -> bool:\n    return any(os.path.basename(f).startswith(\"det_\")\n               for f in glob.glob(os.path.join(pack_dir, \"*.onnx\")))","tryCatchPattern":"try:\n    engine = InsightFaceEngine(options)\nexcept ValueError as e:\n    if \"no detector\" in str(e):\n        # check stderr skip notice: detector load probably raised inside model_zoo\n        logger.error(\"detector missing/skipped in %s — reinstall pack\", pack_dir)\n        reinstall_pack(options.get(\"model_pack\", \"buffalo_l\"))\n        engine = InsightFaceEngine(options)\n    else:\n        raise","preventionTips":["Watch for the '[insightface] skipped ...' stderr line; it explains why the detector vanished.","Keep onnxruntime version compatible with the pack's ONNX opset.","Validate that det_*.onnx exists and loads before declaring the backend healthy."],"tags":["insightface","face-detection","model-loading","pack-integrity"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}