{"record":{"id":"8d585876f8e4d108","repo":"microsoft/graphrag","slug":"csvtableprovider-only-works-with-filestorage-backe-8d5858","errorCode":null,"errorMessage":"CSVTableProvider only works with FileStorage backends for now.","messagePattern":"CSVTableProvider only works with FileStorage backends for now\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/graphrag-storage/graphrag_storage/tables/csv_table_provider.py","lineNumber":149,"sourceCode":"            encoding: Character encoding for reading/writing CSV files.\n                Defaults to \"utf-8\".\n        \"\"\"\n        return CSVTable(\n            self._storage,\n            table_name,\n            transformer=transformer,\n            truncate=truncate,\n            encoding=encoding,\n        )\n\n    def child(self, name: str | None) -> \"CSVTableProvider\":\n        \"\"\"Create a child provider backed by a child storage namespace.\"\"\"\n        if name is None:\n            return self\n        child_storage = self._storage.child(name)\n        if not isinstance(child_storage, FileStorage):\n            msg = \"CSVTableProvider only works with FileStorage backends for now.\"\n            raise TypeError(msg)\n        return CSVTableProvider(storage=child_storage)\n","sourceCodeStart":131,"sourceCodeEnd":151,"githubUrl":"https://github.com/microsoft/graphrag/blob/f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704/packages/graphrag-storage/graphrag_storage/tables/csv_table_provider.py#L131-L151","documentation":"CSVTableProvider.child() creates a child provider by calling storage.child(name), then re-checks that the result is still a FileStorage (a child of a FileStorage normally is, but a custom Storage subclass could return something else). If the child storage is not file-backed, it raises TypeError to preserve the class invariant.","triggerScenarios":"Calling provider.child('sub') where the underlying storage's child() returns a non-FileStorage object — e.g. a custom FileStorage subclass whose child() builds a blob client, or a monkeypatched storage in tests.","commonSituations":"Extending GraphRAG with a custom storage class that subclasses FileStorage loosely; test doubles replacing child(); refactors of the storage layer changing child() return types.","solutions":["Ensure your custom storage's child() returns a FileStorage (same class or subclass whose instances are FileStorage)","If you need non-file child storage, use a different table provider type for the child","name=None returns self unchanged — pass None when you want no namespacing"],"exampleFix":"# before\nclass MyStorage(FileStorage):\n    def child(self, name):\n        return BlobStorage(...)\n# after\nclass MyStorage(FileStorage):\n    def child(self, name):\n        return MyStorage(self.root_dir / name)","handlingStrategy":"type-guard","validationCode":"child_store = provider._storage.child(name)\nassert isinstance(child_store, FileStorage)","typeGuard":"def safe_child_is_file(provider, name) -> bool:\n    from graphrag_storage import FileStorage\n    return isinstance(provider._storage.child(name), FileStorage)","tryCatchPattern":null,"preventionTips":["Custom storage child() must return the same class family","Test child() round-trips in unit tests for custom storage"],"tags":["csv","type-mismatch","storage","namespacing"],"backgroundTag":"incompatible-backend-type","analyzedSha":"f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704","analyzedAt":"2026-08-27T11:16:29.677Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}