mudler/LocalAI · error · ValueError

no detector (taskname='detection') found in {pack_dir}

Error message

no detector (taskname='detection') found in {pack_dir}

What it means

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.

Source

Thrown at backend/python/insightface/engines.py:299

                skipped.append((os.path.basename(onnx_file), str(err)))
                continue
            if m is None:
                skipped.append((os.path.basename(onnx_file), "unknown taskname"))
                continue
            # First occurrence of each taskname wins (matches FaceAnalysis).
            if m.taskname not in self.models:
                self.models[m.taskname] = m

        if skipped:
            import sys
            print(
                f"[insightface] skipped {len(skipped)} non-pack ONNX file(s) in {pack_dir}: "
                + ", ".join(f"{n} ({why})" for n, why in skipped),
                file=sys.stderr,
            )

        if "detection" not in self.models:
            raise ValueError(f"no detector (taskname='detection') found in {pack_dir}")
        self.det_model = self.models["detection"]

        self.det_model.prepare(0, input_size=self.det_size, det_thresh=self.det_thresh)
        for name, m in self.models.items():
            if name != "detection":
                m.prepare(0)

    def _faces(self, img: np.ndarray) -> list[Any]:
        """Run detection + all non-detection models per face."""
        if self.det_model is None:
            return []
        from insightface.app.common import Face

        bboxes, kpss = self.det_model.detect(img, max_num=0)
        if bboxes is None or bboxes.shape[0] == 0:
            return []
        faces: list[Any] = []
        for i in range(bboxes.shape[0]):

View on GitHub (pinned to 44413a9d06)

Solutions

  1. 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.
  2. Reinstall the full pack so a known-good det_*.onnx is present.
  3. Verify the detector file matches the pack manifest name (det_10g.onnx for buffalo_l) and is not filtered out by _KNOWN_PACK_MANIFESTS.
  4. Ensure onnxruntime is compatible with the pack's ONNX opset (an opset mismatch makes get_model raise and the detector get skipped).
Defensive patterns

Strategy: validation

Validate before calling

import glob, os
detectors = [f for f in glob.glob(os.path.join(pack_dir, "*.onnx"))
             if os.path.basename(f).startswith("det_")]
assert detectors, f"no detector ONNX in {pack_dir}; pack incomplete"

Type guard

def pack_has_detector(pack_dir: str) -> bool:
    return any(os.path.basename(f).startswith("det_")
               for f in glob.glob(os.path.join(pack_dir, "*.onnx")))

Try / catch

try:
    engine = InsightFaceEngine(options)
except ValueError as e:
    if "no detector" in str(e):
        # check stderr skip notice: detector load probably raised inside model_zoo
        logger.error("detector missing/skipped in %s — reinstall pack", pack_dir)
        reinstall_pack(options.get("model_pack", "buffalo_l"))
        engine = InsightFaceEngine(options)
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15). Data as JSON: /api/errors/5afef6975dce3dc2. Report an issue: GitHub.