{"record":{"id":"711d783add58a3f8","repo":"opendatalab/MinerU","slug":"file-path-does-not-exist","errorCode":null,"errorMessage":"{file_path} does not exist.","messagePattern":"(.+?) does not exist\\.","errorType":"exception","errorClass":"LoadImageError","httpStatus":null,"severity":"error","filePath":"mineru/model/table/rec/unet_table/utils.py","lineNumber":167,"sourceCode":"\n    @staticmethod\n    def cvt_two_to_three(img: np.ndarray) -> np.ndarray:\n        \"\"\"gray + alpha → BGR\"\"\"\n        img_gray = img[..., 0]\n        img_bgr = cv2.cvtColor(img_gray, cv2.COLOR_GRAY2BGR)\n\n        img_alpha = img[..., 1]\n        not_a = cv2.bitwise_not(img_alpha)\n        not_a = cv2.cvtColor(not_a, cv2.COLOR_GRAY2BGR)\n\n        new_img = cv2.bitwise_and(img_bgr, img_bgr, mask=img_alpha)\n        new_img = cv2.add(new_img, not_a)\n        return new_img\n\n    @staticmethod\n    def verify_exist(file_path: Union[str, Path]):\n        if not Path(file_path).exists():\n            raise LoadImageError(f\"{file_path} does not exist.\")\n\n\nclass LoadImageError(Exception):\n    pass\n\n\n# Pillow >=v9.1.0 use a slightly different naming scheme for filters.\n# Set pillow_interp_codes according to the naming scheme used.\nif Image is not None:\n    if hasattr(Image, \"Resampling\"):\n        pillow_interp_codes = {\n            \"nearest\": Image.Resampling.NEAREST,\n            \"bilinear\": Image.Resampling.BILINEAR,\n            \"bicubic\": Image.Resampling.BICUBIC,\n            \"box\": Image.Resampling.BOX,\n            \"lanczos\": Image.Resampling.LANCZOS,\n            \"hamming\": Image.Resampling.HAMMING,\n        }","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/opendatalab/MinerU/blob/4fe4bde114a23ee5dd637eae99b767f4669bf58c/mineru/model/table/rec/unet_table/utils.py#L149-L185","documentation":"verify_exist is called before opening str/Path inputs in LoadImage; a path that does not exist on disk raises LoadImageError('<path> does not exist.'). This is a pre-flight check so you get a clear message instead of a FileNotFoundError from PIL.","triggerScenarios":"Passing a wrong/moved file path, a path built from a wrong models_root or output dir, or a relative path resolved against a different cwd.","commonSituations":"Running the pipeline from a different working directory, temp files already cleaned up, path templates with unfilled placeholders.","solutions":["Log/inspect the exact path string and fix the source of the path.","Use absolute paths built from a single configured root.","If the file should have been produced upstream, check that stage's output before this call."],"exampleFix":"# before\nimg = load_image(f'{out_dir}/table_{i}.png')  # out_dir wrong\n\n# after\np = Path(out_dir).resolve() / f'table_{i}.png'\nassert p.exists(), f'missing crop, upstream stage failed: {p}'\nimg = load_image(p)","handlingStrategy":"validation","validationCode":"from pathlib import Path\np = Path(path).resolve()\nif not p.exists():\n    raise FileNotFoundError(f'{p} missing; upstream stage may have failed')","typeGuard":null,"tryCatchPattern":"try:\n    img = load_image(p)\nexcept LoadImageError as e:\n    if 'does not exist' in str(e):\n        return skip_page(p)  # or re-generate the file\n    raise","preventionTips":["Resolve all paths to absolute at startup.","Check producer-stage outputs before running the consumer stage.","Avoid relative paths in long-running services."],"tags":["file-path","image-processing","table-recognition"],"backgroundTag":null,"analyzedSha":"4fe4bde114a23ee5dd637eae99b767f4669bf58c","analyzedAt":"2026-08-14T21:29:18.456Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}