{"record":{"id":"278e210b67ae5904","repo":"docling-project/docling","slug":"file-does-not-exist-or-it-is-not-readable","errorCode":null,"errorMessage":"File does not exist or it is not readable.","messagePattern":"File does not exist or it is not readable\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"docling/backend/utils/image_resource_loader.py","lineNumber":275,"sourceCode":"            return decoded_data\n\n        if not self.enable_local_fetch:\n            raise OperationNotAllowed(\n                \"Fetching local resources is only allowed when set explicitly. \"\n                \"Set options.enable_local_fetch=True.\"\n            )\n\n        # Require base_path for directory confinement (validation done in resolve_relative_path)\n        if not base_path:\n            raise OperationNotAllowed(\n                f\"Local file access requires base_path for directory confinement: '{src_loc}'\"\n            )\n\n        if os.path.isfile(src_loc) and os.access(src_loc, os.R_OK):\n            with open(src_loc, \"rb\") as f:\n                return f.read()\n        else:\n            raise ValueError(\"File does not exist or it is not readable.\")\n","sourceCodeStart":257,"sourceCodeEnd":276,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/backend/utils/image_resource_loader.py#L257-L276","documentation":"Local fetch was allowed and base_path given, but the resolved path either does not exist as a file or the process lacks read permission (os.path.isfile + os.access checks both failed). Raised as ValueError; the loader refuses to guess between missing and unreadable.","triggerScenarios":"Document references a local image path that does not exist (broken relative path, wrong casing on case-sensitive filesystems, image not shipped with the document) or a file the process cannot read (permission bits, root-squashed mounts).","commonSituations":"Copying an HTML file without its _files/ asset folder; extracting archives that drop images; paths with spaces or URL-encoded characters; files owned by another user in containers.","solutions":["Verify the image exists next to the source document and the src attribute resolves to it (check spelling, case, subdirectory).","Fix permissions: chmod the file readable by the running user/group.","Re-package the document with its assets so relative references resolve under base_path.","Remove the dangling reference from the input if the image is optional."],"exampleFix":"# before\n# index.html references <img src=\"images/Chart1.PNG\"> but on disk it is chart1.png\n\n# after\n# rename the asset to match the reference exactly (case-sensitive FS)\n$ mv images/chart1.png images/Chart1.PNG","handlingStrategy":"validation","validationCode":"import os\n\ndef local_image_readable(abs_path: str) -> bool:\n    return os.path.isfile(abs_path) and os.access(abs_path, os.R_OK)","typeGuard":null,"tryCatchPattern":"try:\n    data = loader.load_image_data(src, base_path)\nexcept ValueError as e:\n    if \"not exist\" in str(e) or \"not readable\" in str(e):\n        logger.warning(\"missing/unreadable image %s; continuing without it\", src)\n    else:\n        raise","preventionTips":["Package HTML with its asset directories and verify the tree before conversion.","On case-sensitive filesystems, match src casing to real filenames exactly.","Run conversions as a user with read access to the document tree."],"tags":["images","local-files","filesystem","permissions"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}