{"id":"0fbb9f463fd72aeb","repo":"pypa/pip","slug":"error-reading-path-e","errorCode":null,"errorMessage":"Error reading {path}: {e}","messagePattern":"Error reading (.+?): (.+?)","errorType":"exception","errorClass":"InstallationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/req/req_dependency_group.py","lineNumber":86,"sourceCode":"\n    return resolvers\n\n\ndef _load_pyproject(path: str) -> dict[str, Any]:\n    \"\"\"\n    This helper loads a pyproject.toml as TOML.\n\n    It raises an InstallationError if the operation fails.\n    \"\"\"\n    try:\n        with open(path, \"rb\") as fp:\n            return tomllib.load(fp)\n    except FileNotFoundError:\n        raise InstallationError(f\"{path} not found. Cannot resolve '--group' option.\")\n    except tomllib.TOMLDecodeError as e:\n        raise InstallationError(f\"Error parsing {path}: {e}\") from e\n    except OSError as e:\n        raise InstallationError(f\"Error reading {path}: {e}\") from e\n","sourceCodeStart":68,"sourceCodeEnd":87,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/req/req_dependency_group.py#L68-L87","documentation":"Raised when the pyproject.toml for '--group' exists and parses location-wise but cannot be read due to a generic OSError (everything other than FileNotFoundError and TOMLDecodeError, which have their own handlers). Typical causes are permission denied or an I/O error reading the file.","triggerScenarios":"Calling '--group ./pyproject.toml:dev' where the file exists but open(path,'rb') raises PermissionError (mode 000 or owned by another user with no read bit), or a broken symlink, or a filesystem I/O error (NFS hiccup, disk error).","commonSituations":"Files created by a different user/container without read permission; read-only mounts in CI; dangling symlinks; container user mismatch between the layer that wrote pyproject.toml and the one running pip.","solutions":["Check permissions/ownership: 'ls -l <path>' and 'id'.","Grant read access: 'chmod +r <path>' or adjust ownership with chown.","If a symlink, confirm the target exists: 'readlink -f <path>'.","Re-mount the volume read/write if running inside a container with a read-only bind mount."],"exampleFix":"# before: file mode 000 or no read bit\nchmod 000 pyproject.toml && pip install --group ./pyproject.toml:dev\n\n# after\nchmod 644 pyproject.toml && pip install --group ./pyproject.toml:dev","handlingStrategy":"validation","validationCode":"import os, sys\npath = sys.argv[1]\nif not os.access(path, os.R_OK):\n    raise SystemExit(f'{path} not readable; fix permissions before running pip')","typeGuard":"def is_readable(path: str) -> bool:\n    import os\n    return os.path.isfile(path) and os.access(path, os.R_OK)","tryCatchPattern":"import os\ntry:\n    with open(path, 'rb') as f:\n        f.read(1)\n    run_pip(['install', '--group', f'{path}:dev'])\nexcept OSError as e:\n    print(f'cannot read {path}: {e}; fix perms/mount then retry')","preventionTips":["In Docker, ensure the pip user owns or can read pyproject.toml.","Mount config volumes read/write, not read-only, when pip must read them.","Avoid broken symlinks: validate with os.path.realpath in setup."],"tags":["dependency-groups","pep735","filesystem","permissions"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}