{"record":{"id":"844542b8b026e29c","repo":"hacksider/Deep-Live-Cam","slug":"model-file-not-found-model-path","errorCode":null,"errorMessage":"Model file not found: {model_path}","messagePattern":"Model file not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"critical","filePath":"modules/processors/frame/face_enhancer_gpen256.py","lineNumber":62,"sourceCode":"\n\ndef pre_start() -> bool:\n    if not is_image(modules.globals.target_path) and not is_video(modules.globals.target_path):\n        update_status(\"Select an image or video for target path.\", NAME)\n        return False\n    return True\n\n\ndef get_enhancer() -> Any:\n    global ENHANCER\n    with THREAD_LOCK:\n        if ENHANCER is None:\n            model_path = os.path.join(models_dir, MODEL_FILE)\n            if not os.path.exists(model_path):\n                from modules.utilities import conditional_download\n                conditional_download(models_dir, [MODEL_URL])\n            if not os.path.exists(model_path):\n                raise FileNotFoundError(f\"Model file not found: {model_path}\")\n            print(f\"{NAME}: Loading ONNX model from {model_path}\")\n            ENHANCER = create_onnx_session(model_path)\n            warmup_session(ENHANCER)\n            print(f\"{NAME}: Model loaded successfully.\")\n    return ENHANCER\n\n\ndef enhance_face(temp_frame: Frame, face: Face) -> Frame:\n    try:\n        session = get_enhancer()\n    except Exception as e:\n        print(f\"{NAME}: {e}\")\n        return temp_frame\n    try:\n        return enhance_face_onnx(temp_frame, face, session, INPUT_SIZE)\n    except Exception as e:\n        print(f\"{NAME}: Error during face enhancement: {e}\")\n        return temp_frame","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/hacksider/Deep-Live-Cam/blob/987f6b392b1740623b3fa8a5cb46fdd0b7e185b9/modules/processors/frame/face_enhancer_gpen256.py#L44-L80","documentation":"FileNotFoundError raised in get_enhancer (modules/processors/frame/face_enhancer_gpen256.py) when the GPEN 256px ONNX model is still absent after an automatic download attempt. The loader first checks for the file, calls conditional_download(models_dir, [MODEL_URL]) if missing, then re-checks: if the download did not produce the file (network failure, unreachable URL, unwritable directory), it raises with the resolved path.","triggerScenarios":"Offline machine or blocked network so conditional_download fails silently or raises internally; MODEL_URL is dead/moved; the models directory does not exist or lacks write permission so the download cannot land; download completes but under a different filename than MODEL_FILE expects.","commonSituations":"Air-gapped or proxy-restricted environments where the model host is unreachable; CI containers without network egress; a re-uploaded/moved model hosting bucket; read-only mounts (e.g. container image layer) for the models dir; disk-full during download.","solutions":["Manually download the model from MODEL_URL (inspect MODEL_URL at the top of face_enhancer_gpen256.py) and place it in the models directory, matching the exact MODEL_FILE name.","Check network reachability of the model host and any proxy/firewall rules; retry with the environment that permits egress.","Ensure the models directory exists and is writable (mkdir -p, fix ownership/permissions), and disk space is sufficient.","If the URL is dead, get the file from the project's release/mirror and verify its filename equals MODEL_FILE."],"exampleFix":"# before\n# relying on auto-download in a network-restricted environment:\nsession = get_enhancer()\n\n# after\n# pre-seed the model so no download is needed at runtime:\n# curl -L -o <models_dir>/<MODEL_FILE> <MODEL_URL>\nsession = get_enhancer()","handlingStrategy":"validation","validationCode":"import os, urllib.request\nmodel_path = os.path.join(models_dir, MODEL_FILE)  # MODEL_FILE from face_enhancer_gpen256\nif not os.path.exists(model_path):\n    os.makedirs(models_dir, exist_ok=True)\n    urllib.request.urlretrieve(MODEL_URL, model_path)  # fail loudly here, not at runtime\nsession = get_enhancer()","typeGuard":null,"tryCatchPattern":"try:\n    session = get_enhancer()\nexcept FileNotFoundError as e:\n    raise SystemExit(\n        f\"Model download failed: {e}. Fetch {MODEL_URL} into {models_dir} manually.\"\n    )","preventionTips":["Pre-seed model files in deployment images; never depend on runtime network access.","Verify models dir writability and disk space during environment setup.","After manual download, confirm the filename exactly matches MODEL_FILE."],"tags":["python","onnx","model-download","network","file-not-found","face-enhancement"],"backgroundTag":null,"analyzedSha":"987f6b392b1740623b3fa8a5cb46fdd0b7e185b9","analyzedAt":"2026-08-14T19:48:25.860Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}