{"record":{"id":"a1ad419026f988c0","repo":"run-llama/llama_index","slug":"all-memory-blocks-must-have-unique-names","errorCode":null,"errorMessage":"All memory blocks must have unique names.","messagePattern":"All memory blocks must have unique names\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/memory/memory.py","lineNumber":284,"sourceCode":"    def validate_memory(cls, values: dict) -> dict:\n        # Validate token limit\n        token_limit = values.get(\"token_limit\", -1)\n        if token_limit < 1:\n            raise ValueError(\"Token limit must be set and greater than 0.\")\n\n        tokenizer_fn = values.get(\"tokenizer_fn\")\n        if tokenizer_fn is None:\n            values[\"tokenizer_fn\"] = get_tokenizer()\n\n        if values.get(\"token_flush_size\", -1) < 1:\n            values[\"token_flush_size\"] = int(token_limit * 0.1)\n        elif values.get(\"token_flush_size\", -1) > token_limit:\n            values[\"token_flush_size\"] = int(token_limit * 0.1)\n\n        # validate all blocks have unique names\n        block_names = [block.name for block in values.get(\"memory_blocks\", [])]\n        if len(block_names) != len(set(block_names)):\n            raise ValueError(\"All memory blocks must have unique names.\")\n\n        return values\n\n    @classmethod\n    def from_defaults(  # type: ignore[override]\n        cls,\n        session_id: Optional[str] = None,\n        chat_history: Optional[List[ChatMessage]] = None,\n        token_limit: int = DEFAULT_TOKEN_LIMIT,\n        memory_blocks: Optional[List[BaseMemoryBlock[Any]]] = None,\n        tokenizer_fn: Optional[Callable[[str], List]] = None,\n        chat_history_token_ratio: float = 0.7,\n        token_flush_size: int = DEFAULT_FLUSH_SIZE,\n        memory_blocks_template: RichPromptTemplate = DEFAULT_MEMORY_BLOCKS_TEMPLATE,\n        insert_method: InsertMethod = InsertMethod.SYSTEM,\n        image_token_size_estimate: int = 256,\n        audio_token_size_estimate: int = 256,\n        video_token_size_estimate: int = 256,","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/memory/memory.py#L266-L302","documentation":"Error \"All memory blocks must have unique names.\" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/memory/memory.py:284 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Give each memory block a unique name in the memory_blocks list.","Rename or remove duplicate memory blocks so all names are distinct."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}