{"record":{"id":"8d81adc0c722b593","repo":"deepinsight/insightface","slug":"dataset-root-not-found-root","errorCode":null,"errorMessage":"Dataset root not found: {root}","messagePattern":"Dataset root not found: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python-package/insightface/gui/core/evaluation.py","lineNumber":833,"sourceCode":"        score = cosine_similarity(query_embedding, sample[\"embedding\"])\n        identity = str(sample[\"identity\"])\n        if identity not in best_by_identity or score > best_by_identity[identity]:\n            best_by_identity[identity] = score\n    return sorted(best_by_identity.items(), key=lambda item: item[1], reverse=True)\n\n\ndef run_identity_identification_evaluation(\n    dataset_root: str | Path,\n    engine: FaceEngine,\n    auto_split: bool = False,\n    multi_face_policy: str = MULTI_FACE_REQUIRE_ONE,\n    license_status: str = DEFAULT_LICENSE_STATUS,\n    progress_callback=None,\n    cancel_callback=None,\n) -> EvaluationResult:\n    root = Path(dataset_root).expanduser()\n    if not root.is_dir():\n        raise ValueError(f\"Dataset root not found: {root}\")\n    gallery_items, probe_items, unknown_items = (\n        _collect_gallery_probe_auto_split(root) if auto_split else _collect_gallery_probe_structured(root)\n    )\n    if not gallery_items:\n        raise ValueError(\"1:N evaluation requires at least one gallery image.\")\n    if not probe_items:\n        raise ValueError(\"1:N evaluation requires at least one known probe image.\")\n\n    errors: List[Dict[str, Any]] = []\n    cache: Dict[str, np.ndarray] = {}\n    gallery: List[Dict[str, Any]] = []\n    start_all = time.perf_counter()\n    for index, item in enumerate(gallery_items):\n        embedding = _embedding_for_image(\n            Path(item[\"path\"]),\n            engine,\n            cache,\n            errors,","sourceCodeStart":815,"sourceCodeEnd":851,"githubUrl":"https://github.com/deepinsight/insightface/blob/7fadd420c2351d0ffa8cac403421c1a3ed733365/python-package/insightface/gui/core/evaluation.py#L815-L851","documentation":"Raised by run_identity_identification_evaluation when dataset_root does not exist or is not a directory (after expanduser). It is a precondition check before any collection or embedding work happens.","triggerScenarios":"Passing a nonexistent, mistyped, or file (not directory) path as dataset_root; relative path resolved against an unexpected working directory; '~' expansion producing a wrong path.","commonSituations":"Wrong CWD when using relative paths; typo in path; dataset moved/renamed; path from config that references a machine-specific location; container volume not mounted.","solutions":["Check Path(dataset_root).expanduser().resolve().is_dir() before calling","Fix typos or use absolute paths (or resolve relative to a known anchor file)","If in a container/remote env, confirm the dataset volume is mounted at the expected path","Log the resolved path to catch CWD-dependent relative path issues"],"exampleFix":"# before\nresult = run_identity_identification_evaluation(\"data/ids\", ...)\n# after\nfrom pathlib import Path\nroot = Path(\"data/ids\").expanduser().resolve()\nassert root.is_dir(), f\"missing dataset root: {root}\"\nresult = run_identity_identification_evaluation(root, ...)","handlingStrategy":"validation","validationCode":"from pathlib import Path\nroot = Path(dataset_root).expanduser().resolve()\nif not root.is_dir():\n    raise FileNotFoundError(root)","typeGuard":"def is_valid_dataset_root(root: str | Path) -> bool:\n    p = Path(root).expanduser()\n    return p.is_dir()","tryCatchPattern":"try:\n    result = run_identity_identification_evaluation(dataset_root, ...)\nexcept ValueError as e:\n    if \"Dataset root not found\" in str(e):\n        fix_and_retry_with_resolved_path()","preventionTips":["Resolve paths against a known anchor, not CWD","Fail fast on missing dataset paths at app startup","In containers, verify volume mounts before evaluation jobs"],"tags":["insightface","path","dataset","filesystem"],"backgroundTag":"path-not-found","analyzedSha":"7fadd420c2351d0ffa8cac403421c1a3ed733365","analyzedAt":"2026-08-28T15:44:01.850Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}