{"record":{"id":"8ba720db062b4d6a","repo":"infiniflow/ragflow","slug":"credentials-json-missing-primary-admin-key","errorCode":null,"errorMessage":"Credentials json missing primary admin key","messagePattern":"Credentials json missing primary admin key","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"common/data_source/google_drive/connector.py","lineNumber":200,"sourceCode":"\n    @property\n    def google_domain(self) -> str:\n        if self._primary_admin_email is None:\n            raise RuntimeError(\"Primary admin email missing, should not call this property before calling load_credentials\")\n        return self._primary_admin_email.split(\"@\")[-1]\n\n    @property\n    def creds(self) -> OAuthCredentials | ServiceAccountCredentials:\n        if self._creds is None:\n            raise RuntimeError(\"Creds missing, should not call this property before calling load_credentials\")\n        return self._creds\n\n    # TODO: ensure returned new_creds_dict is actually persisted when this is called?\n    def load_credentials(self, credentials: dict[str, Any]) -> dict[str, Any] | None:\n        try:\n            self._primary_admin_email = credentials[DB_CREDENTIALS_PRIMARY_ADMIN_KEY]\n        except KeyError:\n            raise ValueError(\"Credentials json missing primary admin key\")\n\n        self._creds, new_creds_dict = get_google_creds(\n            credentials=credentials,\n            source=DocumentSource.GOOGLE_DRIVE,\n        )\n\n        # Service account connectors don't have a specific setting determining whether\n        # to include \"shared with me\" for each user, so we default to true unless the connector\n        # is in specific folders/drives mode. Note that shared files are only picked up during\n        # the My Drive stage, so this does nothing if the connector is set to only index shared drives.\n        if isinstance(self._creds, ServiceAccountCredentials) and not self.specific_requests_made:\n            self.include_files_shared_with_me = True\n\n        self._creds_dict = new_creds_dict\n        self._all_drive_ids_cache = None\n\n        return new_creds_dict\n","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/google_drive/connector.py#L182-L218","documentation":"Error \"Credentials json missing primary admin key\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at common/data_source/google_drive/connector.py:200 when the library encounters an invalid state.","commonSituations":"The Google Workspace credentials JSON lacks the primary admin entry required for domain-wide delegation; adding it prevents this error.","solutions":["Add the primary admin key to the service account credentials JSON.","Set DB_CREDENTIALS_PRIMARY_ADMIN_KEY and rebuild the credentials payload."],"exampleFix":"credentials_json['primary_admin'] = '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-15T17:31:12.345Z"}