{"record":{"id":"a8b460d7b566f4a5","repo":"ComposioHQ/composio","slug":"file-not-readable-file-please-check-the-file-p","errorCode":null,"errorMessage":"File not readable: {file}. Please check the file permissions.","messagePattern":"File not readable: (.+?)\\. Please check the file permissions\\.","errorType":"exception","errorClass":"SDKFileNotFoundError","httpStatus":null,"severity":"error","filePath":"python/composio/core/models/_files.py","lineNumber":650,"sourceCode":"            path_in,\n            enabled=sensitive_file_upload_protection,\n            additional_deny_segments=file_upload_path_deny_segments,\n        )\n\n        # Handle as local file path\n        file = Path(path_in)\n        if not file.exists():\n            raise SDKFileNotFoundError(\n                f\"File not found: {file}. Please provide a valid file path.\"\n            )\n\n        if not file.is_file():\n            raise SDKFileNotFoundError(\n                f\"Not a file: {file}. Please provide a valid file path.\"\n            )\n\n        if not os.access(file, os.R_OK):\n            raise SDKFileNotFoundError(\n                f\"File not readable: {file}. Please check the file permissions.\"\n            )\n\n        mimetype = mimetypes.guess(file=file)\n        s3meta = _request_presigned_upload(\n            client,\n            filename=file.name,\n            md5=get_md5(file=file),\n            mimetype=mimetype,\n            tool=tool,\n            toolkit=toolkit,\n        )\n        upload(url=s3meta.new_presigned_url, file=file, mimetype=mimetype)\n        return cls(name=file.name, mimetype=mimetype, s3key=s3meta.key)\n\n\ndef _discard_partial_download(outfile: Path) -> None:\n    \"\"\"Remove a half-written download so it is never mistaken for the file.","sourceCodeStart":632,"sourceCodeEnd":668,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/python/composio/core/models/_files.py#L632-L668","documentation":"Final pre-upload local check: the path exists and is a regular file, but os.access(file, os.R_OK) fails — the running process lacks read permission — so SDKFileNotFoundError (with a permissions message) is raised.","triggerScenarios":"from_path on a file owned by another user with mode 600/000, files under restrictive ACLs, or container runs where the file is mounted read-denied (root-owned file, non-root process).","commonSituations":"Docker volumes with root-owned files read by an app user; files created by a service under a different UID; umask/ACL restrictions; NFS exports limiting the client user.","solutions":["chmod +r the file (chmod 644) or chown it to the running user.","In containers, ensure the volume/mount grants read to the app UID, or COPY --chmod.","Copy the file to a readable temp location and upload that.","Run the process as a user with read access."],"exampleFix":"# before (container: file owned by root, app runs as appuser)\nfile = FileModel.from_path(client, Path('/data/secret.pdf'))  # not readable\n# after\n# Dockerfile: COPY --chmod=644 secret.pdf /data/secret.pdf\n# or at runtime:\nimport shutil\ntmp = Path('/tmp/secret.pdf'); shutil.copy('/data/secret.pdf', tmp)\nfile = FileModel.from_path(client, tmp)","handlingStrategy":"validation","validationCode":"import os\nfrom pathlib import Path\n\ndef readable_file(p) -> bool:\n    f = Path(p)\n    return f.is_file() and os.access(f, os.R_OK)","typeGuard":"def is_readable_file(p) -> bool:\n    import os\n    from pathlib import Path\n    f = Path(p)\n    return f.is_file() and os.access(f, os.R_OK)","tryCatchPattern":"from composio.core.models._files import SDKFileNotFoundError\n\ntry:\n    model = FileModel.from_path(client, p)\nexcept SDKFileNotFoundError as e:\n    if 'not readable' in str(e):\n        tmp = Path(tempfile.mkstemp()[1])\n        shutil.copy(p, tmp)\n        model = FileModel.from_path(client, tmp)\n    else:\n        raise","preventionTips":["Run the app as a user with read rights on mounted files.","Use COPY --chmod in Dockerfiles; fix volume permissions.","Check os.access(p, os.R_OK) during input validation."],"tags":["python","filesystem","permissions","upload"],"backgroundTag":"file-not-readable","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}