pathwaycom/pathway · error · ValueError

Unrecognized connector mode: {mode}

Error message

Unrecognized connector mode: {mode}

What it means

Raised by pw.io.gdrive.read when the `mode` argument is neither "streaming" nor "static". These are the only two connector modes: streaming re-polls the Drive folder for changes, static reads the objects once.

Source

Thrown at python/pathway/io/gdrive/__init__.py:593

            in processing at any moment. Reading pauses when the limit is reached and resumes
            as processing of some entries completes. Useful with large sources that
            emit an initial burst of data to avoid memory spikes.

    Returns:
        The table read.

    Example:

    >>> import pathway as pw
    ...
    >>> table = pw.io.gdrive.read(
    ...     object_id="0BzDTMZY18pgfcGg4ZXFRTDFBX0j",
    ...     service_user_credentials_file="credentials.json"
    ... )
    """

    if mode not in ["streaming", "static"]:
        raise ValueError(f"Unrecognized connector mode: {mode}")

    def credentials_factory() -> ServiceCredentials:
        from google.oauth2.service_account import Credentials as ServiceCredentials

        return ServiceCredentials.from_service_account_file(
            fspath(service_user_credentials_file)
        )

    only_provide_metadata = format == "only_metadata"
    subject = _GDriveSubject(
        credentials_factory=credentials_factory,
        root=object_id,
        refresh_interval=as_duration_seconds(refresh_interval, "refresh_interval"),
        mode=mode,
        only_metadata=only_provide_metadata,
        with_metadata=with_metadata or only_provide_metadata,
        object_size_limit=object_size_limit,
        file_name_pattern=file_name_pattern,

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Use mode="streaming" (continuous re-reads) or mode="static" (single read), exactly lowercase.
  2. Normalize config-supplied modes: mode = config["mode"].lower() and validate it is in {"streaming", "static"} before the call.

Example fix

# before
pw.io.gdrive.read(object_id=obj, service_user_credentials_file=cred, mode="Static")

# after
pw.io.gdrive.read(object_id=obj, service_user_credentials_file=cred, mode="static")
Defensive patterns

Strategy: validation

Validate before calling

mode = mode.lower() if isinstance(mode, str) else mode
assert mode in ("streaming", "static"), 'mode must be "streaming" or "static"'

Type guard

def is_valid_gdrive_mode(mode: str) -> bool:
    return mode in ("streaming", "static")

Prevention

When it happens

Trigger: pw.io.gdrive.read(object_id=..., service_user_credentials_file=..., mode="batch") or mode="Static" — anything other than the exact lowercase strings "streaming" or "static".

Common situations: Passing a mode from a config/env var with different casing or wording; copying mode values from other connectors (e.g. "static_with_deletions" or "batch") that have larger mode sets.

Related errors


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/2e55b2eeec7b70e7. Report an issue: GitHub.