{"record":{"id":"e4a25393d6bd1bc1","repo":"pathwaycom/pathway","slug":"unknown-list-objects-strategy-self-list-objects","errorCode":null,"errorMessage":"Unknown list objects strategy: {self.list_objects_strategy}","messagePattern":"Unknown list objects strategy: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/gdrive/__init__.py","lineNumber":393,"sourceCode":"\n            case _ListObjectsStrategy.FullScan:\n                items = self._detect_objects_with_full_scan()\n\n            case _ListObjectsStrategy.SingleObjectRequest:\n                item = self._get(self.root)\n                if item is None:\n                    items = []\n                elif item[\"mimeType\"] != MIME_TYPE_FOLDER:\n                    items = [item]\n                else:\n                    logging.error(\n                        f\"The object {self.root} is not expected to be a folder\"\n                    )\n                    self.list_objects_strategy = _ListObjectsStrategy.TreeTraversal\n                    return self.tree()\n\n            case _:\n                raise ValueError(\n                    f\"Unknown list objects strategy: {self.list_objects_strategy}\"\n                )\n\n        items = self._apply_filters(items)\n        items = [extend_metadata(file) for file in items]\n        return _GDriveTree({file[\"id\"]: file for file in items})\n\n\n@dataclass(frozen=True)\nclass _GDriveTree:\n    files: dict[str, GDriveFile]\n\n    def _diff(self, other: _GDriveTree) -> list[GDriveFile]:\n        return [file for file in self.files.values() if file[\"id\"] not in other.files]\n\n    def _modified_files(self, previous: _GDriveTree) -> list[GDriveFile]:\n        result = []\n        for file in self.files.values():","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/gdrive/__init__.py#L375-L411","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nreader = GDriveReader(..., list_objects_strategy=\"tree\")\n\n# after\nfrom pathway.io.gdrive import _ListObjectsStrategy\nreader = GDriveReader(..., list_objects_strategy=_ListObjectsStrategy.TreeTraversal)","handlingStrategy":"type-guard","validationCode":"from pathway.io.gdrive import _ListObjectsStrategy\nif isinstance(list_objects_strategy, str):\n    list_objects_strategy = _ListObjectsStrategy[list_objects_strategy]  # raises KeyError if invalid","typeGuard":"from enum import Enum\n\ndef is_valid_list_strategy(s) -> bool:\n    return isinstance(s, Enum) and s in _ListObjectsStrategy","tryCatchPattern":"try:\n    strategy = _ListObjectsStrategy[strategy_name]\nexcept KeyError:\n    raise ValueError(\n        f\"unknown list_objects_strategy {strategy_name!r}; \"\n        f\"valid: {list(_ListObjectsStrategy)}\"\n    )","preventionTips":["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."],"tags":["gdrive","enum","connector","internal-api"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}