{"record":{"id":"17fe9e3c0c2e4274","repo":"infiniflow/ragflow","slug":"google-drive-credentials-are-missing-required-scop","errorCode":null,"errorMessage":"Google Drive credentials are missing required scopes.","messagePattern":"Google Drive credentials are missing required scopes\\.","errorType":"validation","errorClass":"InsufficientPermissionsError","httpStatus":null,"severity":"error","filePath":"common/data_source/google_drive/connector.py","lineNumber":1142,"sourceCode":"\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\n    def validate_checkpoint_json(self, checkpoint_json: str) -> GoogleDriveCheckpoint:\n        return GoogleDriveCheckpoint.model_validate_json(checkpoint_json)\n\n\nclass CheckpointOutputWrapper:","sourceCodeStart":1124,"sourceCodeEnd":1160,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/google_drive/connector.py#L1124-L1160","documentation":"Error \"Google Drive credentials are missing required scopes.\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at common/data_source/google_drive/connector.py:1142 when the library encounters an invalid state.","commonSituations":"The granted Google token lacks scopes the connector requires; re-authorizing with the full scope set prevents this error.","solutions":["Add the missing OAuth scopes and re-run the authorization flow."],"exampleFix":"# request drive.readonly and admin.directory.readonly scopes, then re-consent","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-15T22:17:37.221Z"}