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 delegates all file access to a GraphRAG FileStorage instance and relies on filesystem-specific behavior, so its constructor type-checks the injected storage. Passing any other Storage implementation (blob, memory, cosmos) raises TypeError immediately.

Source

Thrown at packages/graphrag-storage/graphrag_storage/tables/csv_table_provider.py:40

    """Table provider that stores tables as CSV files using an underlying Storage instance.

    This provider converts between pandas DataFrames and csv format,
    storing the data through a Storage backend (file, blob, cosmos, etc.).
    """

    def __init__(self, storage: Storage, **kwargs) -> None:
        """Initialize the CSV table provider with an underlying storage instance.

        Args
        ----
            storage: Storage
                The storage instance to use for reading and writing csv files.
            **kwargs: Any
                Additional keyword arguments (currently unused).
        """
        if not isinstance(storage, FileStorage):
            msg = "CSVTableProvider only works with FileStorage backends for now. "
            raise TypeError(msg)
        self._storage = storage

    async def read_dataframe(self, table_name: str) -> pd.DataFrame:
        """Read a table from storage as a pandas DataFrame.

        Args
        ----
            table_name: str
                The name of the table to read. The file will be accessed as '{table_name}.csv'.

        Returns
        -------
            pd.DataFrame:
                The table data loaded from the csv file.

        Raises
        ------
            ValueError:

View on GitHub (pinned to f40e9a26ce)

Solutions

  1. Set the storage backend to file (type: file_storage / file) so the csv provider gets a FileStorage
  2. Or switch the table provider to one matching your backend (e.g. blob-backed parquet table provider)
  3. Ensure base_dir is configured for FileStorage

Example fix

# before
storage:
  type: blob
...
table_storage:
  type: csv
# after
storage:
  type: file
  base_dir: output
table_storage:
  type: csv
Defensive patterns

Strategy: type-guard

Validate before calling

from graphrag_storage import FileStorage
assert isinstance(storage, FileStorage)

Type guard

def is_file_storage(s) -> bool:
    from graphrag_storage import FileStorage
    return isinstance(s, FileStorage)

Prevention

When it happens

Trigger: Constructing CSVTableProvider(storage=some_blob_or_memory_storage), or a factory wiring where table storage resolves to a non-file backend while the table provider type is 'csv'.

Common situations: settings.yaml sets the base storage type to blob (or the output storage to blob) but leaves table type as csv — the csv provider receives the blob storage and rejects it.

Related errors


AI-assisted analysis of microsoft/graphrag@f40e9a26ce (2026-08-27). Data as JSON: /api/errors/4ec75bcfc8927a22. Report an issue: GitHub.