microsoft/graphrag · error · TypeError
CSVTableProvider only works with FileStorage backends for no
Error message
CSVTableProvider only works with FileStorage backends for now.
What it means
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.
Source
Thrown at packages/graphrag-storage/graphrag_storage/tables/csv_table_provider.py:149
encoding: Character encoding for reading/writing CSV files.
Defaults to "utf-8".
"""
return CSVTable(
self._storage,
table_name,
transformer=transformer,
truncate=truncate,
encoding=encoding,
)
def child(self, name: str | None) -> "CSVTableProvider":
"""Create a child provider backed by a child storage namespace."""
if name is None:
return self
child_storage = self._storage.child(name)
if not isinstance(child_storage, FileStorage):
msg = "CSVTableProvider only works with FileStorage backends for now."
raise TypeError(msg)
return CSVTableProvider(storage=child_storage)
View on GitHub (pinned to f40e9a26ce)
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
Example fix
# before
class MyStorage(FileStorage):
def child(self, name):
return BlobStorage(...)
# after
class MyStorage(FileStorage):
def child(self, name):
return MyStorage(self.root_dir / name) Defensive patterns
Strategy: type-guard
Validate before calling
child_store = provider._storage.child(name) assert isinstance(child_store, FileStorage)
Type guard
def safe_child_is_file(provider, name) -> bool:
from graphrag_storage import FileStorage
return isinstance(provider._storage.child(name), FileStorage) Prevention
- Custom storage child() must return the same class family
- Test child() round-trips in unit tests for custom storage
When it happens
Trigger: 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.
Common situations: Extending GraphRAG with a custom storage class that subclasses FileStorage loosely; test doubles replacing child(); refactors of the storage layer changing child() return types.
Related errors
- CSVTableProvider only works with FileStorage backends for no
- StorageConfig.type '{storage_strategy}' is not registered in
- Could not find {filename} in storage!
AI-assisted analysis of microsoft/graphrag@f40e9a26ce (2026-08-27).
Data as JSON: /api/errors/8d585876f8e4d108.
Report an issue: GitHub.