{"record":{"id":"792e215e03cbd606","repo":"infiniflow/ragflow","slug":"unable-to-access-source-unknown-credential-str","errorCode":null,"errorMessage":"Unable to access {source} - unknown credential structure.","messagePattern":"Unable to access (.+?) - unknown credential structure\\.","errorType":"exception","errorClass":"PermissionError","httpStatus":null,"severity":"error","filePath":"common/data_source/google_util/auth.py","lineNumber":123,"sourceCode":"                    DB_CREDENTIALS_PRIMARY_ADMIN_KEY: credentials[DB_CREDENTIALS_PRIMARY_ADMIN_KEY],\n                    DB_CREDENTIALS_AUTHENTICATION_METHOD: authentication_method,\n                }\n    elif DB_CREDENTIALS_DICT_SERVICE_ACCOUNT_KEY in credentials:\n        # SERVICE ACCOUNT\n        service_account_key_json_str = credentials[DB_CREDENTIALS_DICT_SERVICE_ACCOUNT_KEY]\n        service_account_key = json.loads(service_account_key_json_str)\n\n        service_creds = ServiceAccountCredentials.from_service_account_info(service_account_key, scopes=GOOGLE_SCOPES[source])\n\n        if not service_creds.valid or not service_creds.expired:\n            service_creds.refresh(Request())\n\n        if not service_creds.valid:\n            raise PermissionError(f\"Unable to access {source} - service account credentials are invalid.\")\n\n    creds: ServiceAccountCredentials | OAuthCredentials | None = oauth_creds or service_creds\n    if creds is None:\n        raise PermissionError(f\"Unable to access {source} - unknown credential structure.\")\n\n    return creds, new_creds_dict\n\n\ndef get_google_oauth_creds(token_json_str: str, source: DocumentSource) -> OAuthCredentials | None:\n    \"\"\"creds_json only needs to contain client_id, client_secret and refresh_token to\n    refresh the creds.\n\n    expiry and token are optional ... however, if passing in expiry, token\n    should also be passed in or else we may not return any creds.\n    (probably a sign we should refactor the function)\n    \"\"\"\n\n    creds_json = json.loads(token_json_str)\n    creds = OAuthCredentials.from_authorized_user_info(\n        info=creds_json,\n        scopes=GOOGLE_SCOPES[source],\n    )","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/google_util/auth.py#L105-L141","documentation":"Error \"Unable to access {source} - unknown credential structure.\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at common/data_source/google_util/auth.py:123 when the library encounters an invalid state.","commonSituations":"The stored Google credential blob matches neither the service account nor OAuth shape; re-saving credentials in a supported format prevents this error.","solutions":["Provide credentials in a supported format: service account JSON or OAuth tokens plus client config."],"exampleFix":"# use either {'service_account_json': ...} or {'access_token':..., 'refresh_token':..., 'client_config':...}","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"}