{"record":{"id":"ce0a7e6c67b23d21","repo":"OpenBMB/ChatDev","slug":"filememory-requires-a-file-memory-store-configurat","errorCode":null,"errorMessage":"FileMemory requires a file memory store configuration","messagePattern":"FileMemory requires a file memory store configuration","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"runtime/node/agent/memory/file_memory.py","lineNumber":36,"sourceCode":"    MemoryItem,\n    MemoryWritePayload,\n)\nfrom entity.configs import MemoryStoreConfig, FileSourceConfig\nfrom entity.configs.node.memory import FileMemoryConfig\n\nlogger = logging.getLogger(__name__)\n\n\nclass FileMemory(MemoryBase):\n    \"\"\"\n    File-based memory system that indexes and retrieves content from files/directories.\n    Supports multiple file types, chunking strategies, and incremental updates.\n    \"\"\"\n\n    def __init__(self, store: MemoryStoreConfig):\n        config = store.as_config(FileMemoryConfig)\n        if not config:\n            raise ValueError(\"FileMemory requires a file memory store configuration\")\n        super().__init__(store)\n\n        if not config.file_sources:\n            raise ValueError(\"FileMemory requires at least one file_source in configuration\")\n\n        self.file_config = config\n        self.file_sources: List[FileSourceConfig] = config.file_sources\n        self.index_path = self.file_config.index_path  # Path to store the index\n\n        # Chunking configuration\n        self.chunk_size = 500  # Characters per chunk\n        self.chunk_overlap = 50  # Overlapping characters between chunks\n\n        # File metadata cache {file_path: {hash, chunks_count, ...}}\n        self.file_metadata: Dict[str, Dict[str, Any]] = {}\n\n    def load(self) -> None:\n        \"\"\"","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/runtime/node/agent/memory/file_memory.py#L18-L54","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the store type to 'file' in the memory configuration","Prefer create_memory(store) so dispatch follows the config type","Check for typos/case in the type string"],"exampleFix":"# before\nstore = MemoryStoreConfig(type='simple', ...)\nmem = FileMemory(store)\n\n# after\nstore = MemoryStoreConfig(type='file', file_sources=[...], ...)\nmem = FileMemory(store)","handlingStrategy":"validation","validationCode":"cfg = store.as_config(FileMemoryConfig)\nif cfg is None:\n    raise ConfigError('store type must be file for FileMemory')\nmem = FileMemory(store)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use create_memory dispatch","Validate memory.type matches the class"],"tags":["memory","configuration","type-mismatch"],"backgroundTag":"config-type-mismatch","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}