infiniflow/ragflow · error · InsufficientPermissionsError

Google Drive credentials are missing required scopes.

Error message

Google Drive credentials are missing required scopes.

What it means

Error "Google Drive credentials are missing required scopes." thrown in infiniflow/ragflow.

Source

Thrown at common/data_source/google_drive/connector.py:1142

            if isinstance(self._creds, ServiceAccountCredentials):
                # default is ~17mins of retries, don't do that here since this is called from
                # the UI
                get_root_folder_id(drive_service)

        except HttpError as e:
            status_code = e.resp.status if e.resp else None
            if status_code == 401:
                raise CredentialExpiredError("Invalid or expired Google Drive credentials (401).")
            elif status_code == 403:
                raise InsufficientPermissionsError("Google Drive app lacks required permissions (403). Please ensure the necessary scopes are granted and Drive apps are enabled.")
            else:
                raise ConnectorValidationError(f"Unexpected Google Drive error (status={status_code}): {e}")

        except Exception as e:
            # Check for scope-related hints from the error message
            if MISSING_SCOPES_ERROR_STR in str(e):
                raise InsufficientPermissionsError("Google Drive credentials are missing required scopes.")
            raise ConnectorValidationError(f"Unexpected error during Google Drive validation: {e}")

    @override
    def build_dummy_checkpoint(self) -> GoogleDriveCheckpoint:
        return GoogleDriveCheckpoint(
            retrieved_folder_and_drive_ids=set(),
            completion_stage=DriveRetrievalStage.START,
            completion_map=ThreadSafeDict(),
            all_retrieved_file_ids=set(),
            has_more=True,
        )

    @override
    def validate_checkpoint_json(self, checkpoint_json: str) -> GoogleDriveCheckpoint:
        return GoogleDriveCheckpoint.model_validate_json(checkpoint_json)


class CheckpointOutputWrapper:

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Add the missing OAuth scopes and re-run the authorization flow.

Example fix

# request drive.readonly and admin.directory.readonly scopes, then re-consent

When it happens

Trigger: Thrown at common/data_source/google_drive/connector.py:1142 when the library encounters an invalid state.

Common situations: The granted Google token lacks scopes the connector requires; re-authorizing with the full scope set prevents this error.


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/17fe9e3c0c2e4274. Report an issue: GitHub.