{"record":{"id":"21a8f8458396dda9","repo":"binary-husky/gpt_academic","slug":"no-read-permission-path","errorCode":null,"errorMessage":"No read permission: {path}","messagePattern":"No read permission: (.+?)","errorType":"exception","errorClass":"PermissionError","httpStatus":null,"severity":"error","filePath":"crazy_functions/doc_fns/read_fns/excel_reader.py","lineNumber":79,"sourceCode":"            with open(file_path, 'rb') as f:\n                raw_data = f.read(10000)\n                result = chardet.detect(raw_data)\n                return result['encoding'] or 'utf-8'\n        except Exception as e:\n            self.logger.warning(f\"Encoding detection failed: {e}. Using utf-8\")\n            return 'utf-8'\n\n    def _validate_file(self, file_path: Union[str, Path]) -> Path:\n        path = Path(file_path).resolve()\n\n        if not path.exists():\n            raise ValueError(f\"File not found: {path}\")\n\n        if not path.is_file():\n            raise ValueError(f\"Not a file: {path}\")\n\n        if not os.access(path, os.R_OK):\n            raise PermissionError(f\"No read permission: {path}\")\n\n        if path.suffix.lower() not in self.SUPPORTED_EXTENSIONS:\n            raise ValueError(\n                f\"Unsupported format: {path.suffix}. \"\n                f\"Supported: {', '.join(sorted(self.SUPPORTED_EXTENSIONS))}\"\n            )\n\n        return path\n\n    def _format_value(self, value: Any) -> str:\n        if pd.isna(value) or value is None:\n            return ''\n        if isinstance(value, (int, float)):\n            return str(value)\n        return str(value).strip()\n\n    def _process_chunk(self, chunk: pd.DataFrame, columns: Optional[List[str]] = None, sheet_name: str = '') -> str:\n        \"\"\"处理数据块，新增sheet_name参数\"\"\"","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/crazy_functions/doc_fns/read_fns/excel_reader.py#L61-L97","documentation":"Third check in ExcelTextExtractor._validate_file: os.access(path, os.R_OK) is false, so PermissionError('No read permission: <path>') is raised. The file exists and is a file, but the current process's effective user lacks read permission (or, on some setups, the path is unreadable via ACL even though it looks fine in ls).","triggerScenarios":"File owned by another user with mode 600; process running as a different user (docker container vs host file); Windows read-only/ACL-denied files; files under /proc-like pseudo filesystems.","commonSituations":"Docker bind-mounts where the container UID differs from the host file owner; files created by a service account; macOS/Linux group permission mismatches.","solutions":["Check ownership and mode: ls -l <path>; compare with the process UID (id)","Grant read: chmod +r <path> (or chown to the running user) — in Docker, match UID or set appropriate file permissions on the mount","On Windows, adjust the file ACL for the service user","Run the reading process under an account with access"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import os\n\nif not os.access(fp, os.R_OK):\n    raise PermissionError(f'grant read on {fp} before extraction')","typeGuard":null,"tryCatchPattern":"try:\n    text = extractor.read_text(fp)\nexcept PermissionError as e:\n    notify_ops(f'fix perms: chmod +r {e}')  # message contains the path\n    raise","preventionTips":["In Docker, align container UID/GID with mounted-file ownership or set world-read","Run extraction under a service account granted read on the data directory","Check os.access(path, os.R_OK) before invoking the extractor"],"tags":["permissions","file-validation","docker","excel","python"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}