{"record":{"id":"9c36319e36dec635","repo":"infiniflow/ragflow","slug":"primary-admin-email-not-found-in-credentials-ensu","errorCode":null,"errorMessage":"Primary admin email not found in credentials. Ensure DB_CREDENTIALS_PRIMARY_ADMIN_KEY is set.","messagePattern":"Primary admin email not found in credentials\\. Ensure DB_CREDENTIALS_PRIMARY_ADMIN_KEY is set\\.","errorType":"validation","errorClass":"ConnectorValidationError","httpStatus":null,"severity":"error","filePath":"common/data_source/google_drive/connector.py","lineNumber":1119,"sourceCode":"        try:\n            checkpoint = self.build_dummy_checkpoint()\n            while checkpoint.completion_stage != DriveRetrievalStage.DONE:\n                yield from self._extract_slim_docs_from_google_drive(\n                    checkpoint=checkpoint,\n                )\n            self.logger.info(\"Drive perm sync: Slim doc retrieval complete\")\n\n        except Exception as e:\n            if MISSING_SCOPES_ERROR_STR in str(e):\n                raise PermissionError() from e\n            raise e\n\n    def validate_connector_settings(self) -> None:\n        if self._creds is None:\n            raise ConnectorMissingCredentialError(\"Google Drive credentials not loaded.\")\n\n        if self._primary_admin_email is None:\n            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}\")","sourceCodeStart":1101,"sourceCodeEnd":1137,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/google_drive/connector.py#L1101-L1137","documentation":"Error \"Primary admin email not found in credentials. Ensure DB_CREDENTIALS_PRIMARY_ADMIN_KEY is set.\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at common/data_source/google_drive/connector.py:1119 when the library encounters an invalid state.","commonSituations":"The credentials payload does not identify a primary admin email for domain-wide delegation; providing it prevents this error.","solutions":["Set the DB_CREDENTIALS_PRIMARY_ADMIN_KEY environment variable.","Include the primary admin email in the credentials JSON."],"exampleFix":"export DB_CREDENTIALS_PRIMARY_ADMIN_KEY=admin@example.com","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"}