{"record":{"id":"018c510fcfe0ee6e","repo":"OpenBMB/ChatDev","slug":"memory-store-attachment-name-not-found","errorCode":null,"errorMessage":"memory store {attachment.name} not found","messagePattern":"memory store (.+?) not found","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"runtime/node/agent/memory/memory_base.py","lineNumber":240,"sourceCode":"        agent_role: str,\n        query: MemoryContentSnapshot,\n        top_k: int,\n        similarity_threshold: float,\n    ) -> List[MemoryItem]:\n        raise NotImplementedError\n\n    def update(self, payload: MemoryWritePayload) -> None:\n        raise NotImplementedError\n\n\nclass MemoryManager:\n    def __init__(self, attachments: List[MemoryAttachmentConfig], stores: Dict[str, MemoryBase]):\n        self.attachments = attachments\n        self.memories: Dict[str, MemoryBase] = {}\n        for attachment in attachments:\n            memory = stores.get(attachment.name)\n            if not memory:\n                raise ValueError(f\"memory store {attachment.name} not found\")\n            self.memories[attachment.name] = memory\n\n    def retrieve(\n        self,\n        agent_role: str,\n        query: MemoryContentSnapshot,\n        current_stage: AgentExecFlowStage,\n    ) -> MemoryRetrievalResult | None:\n        results: List[tuple[str, MemoryItem, float]] = []\n        for attachment in self.attachments:\n            if attachment.retrieve_stage and current_stage not in attachment.retrieve_stage:\n                continue\n            if not attachment.read:\n                continue\n            memory = self.memories.get(attachment.name)\n            if not memory:\n                continue\n            items = memory.retrieve(agent_role, query, attachment.top_k, attachment.similarity_threshold)","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/runtime/node/agent/memory/memory_base.py#L222-L258","documentation":"A memory attachment references a store name that is not in the stores dict passed to the memory attachment aggregator. Every attachment.name must match a key in stores, otherwise construction fails.","triggerScenarios":"An agent declares attachments: [{name: 'long_term'}] but the stores mapping only contains 'short_term'; renaming a store in one place (stores) but not in the attachment list; case mismatch in names.","commonSituations":"Editing YAML where store definitions and attachment references drift apart; dynamically built stores dict that skips failed store creation, leaving the name absent.","solutions":["Make each attachment.name exactly match a key in the stores mapping","If a store failed to build, fix or remove its attachment rather than proceeding","Add a startup check that all attachment names exist in stores before constructing the agent"],"exampleFix":"# before\nattachments=[MemoryAttachmentConfig(name='long_term')]\nstores={'short_term': mem}\n\n# after\nattachments=[MemoryAttachmentConfig(name='short_term')]\nstores={'short_term': mem}","handlingStrategy":"validation","validationCode":"missing = [a.name for a in attachments if a.name not in stores]\nif missing:\n    raise ConfigError(f'attachments reference unknown stores: {missing}')\nagg = MemoryAttachments(attachments, stores)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep store names and attachment names in one source of truth","Validate at agent build time"],"tags":["memory","attachments","name-mismatch"],"backgroundTag":"name-not-found","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}