{"record":{"id":"cb47890bba0f330d","repo":"docling-project/docling","slug":"one-of-credentials-path-or-credentials-is-requ","errorCode":null,"errorMessage":"One of 'credentials_path' or 'credentials' is required.","messagePattern":"One of 'credentials_path' or 'credentials' is required\\.","errorType":"validation","errorClass":"ValueError","httpStatus":422,"severity":"error","filePath":"docling/datamodel/service/sources.py","lineNumber":387,"sourceCode":"                \"./dev/google_drive_credentials.json\",\n            ],\n        ),\n    ]\n\n    credentials: Annotated[\n        Optional[GoogleDriveCredentials],\n        Field(\n            default=None,\n            description=\"OAuth 2.0 Client ID' credentials (available in Google Cloud console). One of 'credentials_path' or 'credentials' is required.\",\n        ),\n    ]\n\n    @model_validator(mode=\"after\")\n    def validate_auth_inputs(self) -> \"GoogleDriveCoordinates\":\n        if not (self.token_path or self.refresh_token):\n            raise ValueError(\"One of 'token_path' or 'refresh_token' is required.\")\n        if not (self.credentials_path or self.credentials):\n            raise ValueError(\"One of 'credentials_path' or 'credentials' is required.\")\n        return self\n","sourceCodeStart":369,"sourceCodeEnd":389,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/datamodel/service/sources.py#L369-L389","documentation":"The same GoogleDriveCoordinates validator requires OAuth 2.0 client credentials: either credentials_path (a file path) or an inline credentials object (GoogleDriveCredentials) must be provided. The client credentials identify the Google Cloud OAuth app; without them the refresh-token flow cannot run, so the model fails validation.","triggerScenarios":"Constructing GoogleDriveCoordinates with refresh_token='...' but no credentials_path and no credentials object; any combination missing both credential sources raises from validate_auth_inputs.","commonSituations":"Passing only a refresh token harvested from another tool without supplying the client_id/client_secret it belongs to; secrets stored per-environment and the credentials file not mounted in the new environment; renaming the field from an older docling release where credentials were configured globally.","solutions":["Download the OAuth client credentials JSON from Google Cloud console and pass credentials_path='client_credentials.json'.","Or embed them inline via credentials=GoogleDriveCredentials(...) (e.g. client_id/client_secret from a secret manager).","Ensure the credentials pair belongs to the same OAuth app that issued your refresh_token."],"exampleFix":"# before\nsrc = GoogleDriveCoordinates(\n    file_id=\"abc123\",\n    refresh_token=\"1//0abc...\",\n)\n\n# after\nsrc = GoogleDriveCoordinates(\n    file_id=\"abc123\",\n    refresh_token=\"1//0abc...\",\n    credentials_path=\"client_credentials.json\",\n)","handlingStrategy":"validation","validationCode":"def has_gdrive_credentials(cfg: dict) -> bool:\n    return bool(cfg.get(\"credentials_path\") or cfg.get(\"credentials\"))\n\nassert has_gdrive_credentials(cfg), \"Google Drive source needs credentials_path or credentials\"","typeGuard":"def gdrive_credentials_complete(cfg: dict) -> bool:\n    return bool(cfg.get(\"credentials_path\") or cfg.get(\"credentials\"))","tryCatchPattern":"try:\n    src = GoogleDriveCoordinates(**cfg)\nexcept ValidationError as e:\n    if \"credentials_path\" in str(e):\n        raise ConfigError(\"Missing OAuth client credentials for Google Drive\") from e\n    raise","preventionTips":["Store the OAuth client JSON in a secret manager and inject its path consistently.","Pair the refresh_token with credentials from the same Google Cloud project."],"tags":["google-drive","oauth","authentication","credentials","validation"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}