OpenBMB/ChatDev · error · ValueError

FileMemory requires a file memory store configuration

Error message

FileMemory requires a file memory store configuration

What it means

FileMemory requires the store config to include a FileMemoryConfig section. store.as_config(FileMemoryConfig) returning None means the MemoryStoreConfig is typed for another memory backend, so the constructor rejects it.

Solutions

  1. Set the store type to 'file' in the memory configuration
  2. Prefer create_memory(store) so dispatch follows the config type
  3. Check for typos/case in the type string

Example fix

# before
store = MemoryStoreConfig(type='simple', ...)
mem = FileMemory(store)

# after
store = MemoryStoreConfig(type='file', file_sources=[...], ...)
mem = FileMemory(store)
Defensive patterns

Strategy: validation

Validate before calling

cfg = store.as_config(FileMemoryConfig)
if cfg is None:
    raise ConfigError('store type must be file for FileMemory')
mem = FileMemory(store)

Prevention

When it happens

Trigger: Instantiating FileMemory with a store config whose type is not 'file' (e.g. 'simple' or 'mem0'), or dispatching create_memory with a mismatched type string.

Common situations: Agent YAML where memory.type doesn't match the class being constructed; typos in the type field; reusing a memory block from a different template.

Related errors


AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27). Data as JSON: /api/errors/ce0a7e6c67b23d21. Report an issue: GitHub.

Appendix: source

Thrown at runtime/node/agent/memory/file_memory.py:36

    MemoryItem,
    MemoryWritePayload,
)
from entity.configs import MemoryStoreConfig, FileSourceConfig
from entity.configs.node.memory import FileMemoryConfig

logger = logging.getLogger(__name__)


class FileMemory(MemoryBase):
    """
    File-based memory system that indexes and retrieves content from files/directories.
    Supports multiple file types, chunking strategies, and incremental updates.
    """

    def __init__(self, store: MemoryStoreConfig):
        config = store.as_config(FileMemoryConfig)
        if not config:
            raise ValueError("FileMemory requires a file memory store configuration")
        super().__init__(store)

        if not config.file_sources:
            raise ValueError("FileMemory requires at least one file_source in configuration")

        self.file_config = config
        self.file_sources: List[FileSourceConfig] = config.file_sources
        self.index_path = self.file_config.index_path  # Path to store the index

        # Chunking configuration
        self.chunk_size = 500  # Characters per chunk
        self.chunk_overlap = 50  # Overlapping characters between chunks

        # File metadata cache {file_path: {hash, chunks_count, ...}}
        self.file_metadata: Dict[str, Dict[str, Any]] = {}

    def load(self) -> None:
        """

View on GitHub (pinned to 4fb2db0ea9)