pathwaycom/pathway · error · ValueError
Unknown list objects strategy: {self.list_objects_strategy}
Error message
Unknown list objects strategy: {self.list_objects_strategy} What it means
Raised inside the Google Drive connector's object listing when self.list_objects_strategy is not one of the known _ListObjectsStrategy members. The match statement over the strategy falls through to the default branch, meaning the enum got an unexpected value (e.g. a raw string instead of the enum, or a value added/renamed across versions).
Source
Thrown at python/pathway/io/gdrive/__init__.py:393
case _ListObjectsStrategy.FullScan:
items = self._detect_objects_with_full_scan()
case _ListObjectsStrategy.SingleObjectRequest:
item = self._get(self.root)
if item is None:
items = []
elif item["mimeType"] != MIME_TYPE_FOLDER:
items = [item]
else:
logging.error(
f"The object {self.root} is not expected to be a folder"
)
self.list_objects_strategy = _ListObjectsStrategy.TreeTraversal
return self.tree()
case _:
raise ValueError(
f"Unknown list objects strategy: {self.list_objects_strategy}"
)
items = self._apply_filters(items)
items = [extend_metadata(file) for file in items]
return _GDriveTree({file["id"]: file for file in items})
@dataclass(frozen=True)
class _GDriveTree:
files: dict[str, GDriveFile]
def _diff(self, other: _GDriveTree) -> list[GDriveFile]:
return [file for file in self.files.values() if file["id"] not in other.files]
def _modified_files(self, previous: _GDriveTree) -> list[GDriveFile]:
result = []
for file in self.files.values():View on GitHub (pinned to fa2f74a464)
Solutions
- Pass the enum member, e.g. list_objects_strategy=_ListObjectsStrategy.TreeTraversal (usually via the public pw.io.gdrive.read API rather than internal classes).
- Convert config strings to the enum explicitly: strategy = _ListObjectsStrategy[value] wrapped in try/except KeyError with a clear config error.
- Align on a single pathway version everywhere if the enum changed across versions.
Example fix
# before reader = GDriveReader(..., list_objects_strategy="tree") # after from pathway.io.gdrive import _ListObjectsStrategy reader = GDriveReader(..., list_objects_strategy=_ListObjectsStrategy.TreeTraversal)
Defensive patterns
Strategy: type-guard
Validate before calling
from pathway.io.gdrive import _ListObjectsStrategy
if isinstance(list_objects_strategy, str):
list_objects_strategy = _ListObjectsStrategy[list_objects_strategy] # raises KeyError if invalid Type guard
from enum import Enum
def is_valid_list_strategy(s) -> bool:
return isinstance(s, Enum) and s in _ListObjectsStrategy Try / catch
try:
strategy = _ListObjectsStrategy[strategy_name]
except KeyError:
raise ValueError(
f"unknown list_objects_strategy {strategy_name!r}; "
f"valid: {list(_ListObjectsStrategy)}"
) Prevention
- Prefer the public pw.io.gdrive.read API over internal reader classes.
- Convert config strings to enums at the config boundary, not deep in connector code.
- Pin the pathway version to avoid enum drift.
When it happens
Trigger: Constructing a GDrive reader where list_objects_strategy is set to a plain string ("tree") or an out-of-enum value instead of _ListObjectsStrategy.TreeTraversal / FlatTraversal; deserializing a strategy from config and passing it through unchecked.
Common situations: Passing strategy names from config files as raw strings; version drift where a strategy constant was renamed; subclassing or monkey-patching the reader with a custom strategy value.
Related errors
- Unrecognized connector mode: {mode}
- Unknown payload format: {req_format}
- parameters `schema` and `id_from` are mutually exclusive
- Received `how` argument of join that is a string. You probab
- How argument of join should be one of JoinMode.INNER, JoinMo
AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15).
Data as JSON: /api/errors/e4a25393d6bd1bc1.
Report an issue: GitHub.