{"record":{"id":"e369db456b403630","repo":"infiniflow/ragflow","slug":"unexpected-google-drive-error-status-status-code","errorCode":null,"errorMessage":"Unexpected Google Drive error (status={status_code}): {e}","messagePattern":"Unexpected Google Drive error \\(status=(.+?)\\): (.+?)","errorType":"validation","errorClass":"ConnectorValidationError","httpStatus":null,"severity":"error","filePath":"common/data_source/google_drive/connector.py","lineNumber":1137,"sourceCode":"            raise ConnectorValidationError(\"Primary admin email not found in credentials. Ensure DB_CREDENTIALS_PRIMARY_ADMIN_KEY is set.\")\n\n        try:\n            drive_service = get_drive_service(self._creds, self._primary_admin_email)\n            drive_service.files().list(pageSize=1, fields=\"files(id)\").execute()\n\n            if isinstance(self._creds, ServiceAccountCredentials):\n                # default is ~17mins of retries, don't do that here since this is called from\n                # the UI\n                get_root_folder_id(drive_service)\n\n        except HttpError as e:\n            status_code = e.resp.status if e.resp else None\n            if status_code == 401:\n                raise CredentialExpiredError(\"Invalid or expired Google Drive credentials (401).\")\n            elif status_code == 403:\n                raise InsufficientPermissionsError(\"Google Drive app lacks required permissions (403). Please ensure the necessary scopes are granted and Drive apps are enabled.\")\n            else:\n                raise ConnectorValidationError(f\"Unexpected Google Drive error (status={status_code}): {e}\")\n\n        except Exception as e:\n            # Check for scope-related hints from the error message\n            if MISSING_SCOPES_ERROR_STR in str(e):\n                raise InsufficientPermissionsError(\"Google Drive credentials are missing required scopes.\")\n            raise ConnectorValidationError(f\"Unexpected error during Google Drive validation: {e}\")\n\n    @override\n    def build_dummy_checkpoint(self) -> GoogleDriveCheckpoint:\n        return GoogleDriveCheckpoint(\n            retrieved_folder_and_drive_ids=set(),\n            completion_stage=DriveRetrievalStage.START,\n            completion_map=ThreadSafeDict(),\n            all_retrieved_file_ids=set(),\n            has_more=True,\n        )\n\n    @override","sourceCodeStart":1119,"sourceCodeEnd":1155,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/google_drive/connector.py#L1119-L1155","documentation":"Error \"Unexpected Google Drive error (status={status_code}): {e}\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at common/data_source/google_drive/connector.py:1137 when the library encounters an invalid state.","commonSituations":"The Drive API returns an unexpected status such as rate limiting or a server error; handling retries prevents this error.","solutions":["Inspect the status code and message from the Drive API for details.","Retry with backoff for transient 5xx errors; fix quota issues for 429."],"exampleFix":"# on 429/5xx: exponential backoff retry","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}