{"record":{"id":"c3794667dd129411","repo":"mem0ai/mem0","slug":"metadata-cannot-be-done-for-procedural-memory","errorCode":null,"errorMessage":"Metadata cannot be done for procedural memory.","messagePattern":"Metadata cannot be done for procedural memory\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/memory/main.py","lineNumber":2021,"sourceCode":"\n        parsed_messages = [\n            {\"role\": \"system\", \"content\": prompt or PROCEDURAL_MEMORY_SYSTEM_PROMPT},\n            *messages,\n            {\n                \"role\": \"user\",\n                \"content\": \"Create procedural memory of the above conversation.\",\n            },\n        ]\n\n        try:\n            procedural_memory = self.llm.generate_response(messages=parsed_messages)\n            procedural_memory = remove_code_blocks(procedural_memory)\n        except Exception as e:\n            logger.error(f\"Error generating procedural memory summary: {e}\")\n            raise\n\n        if metadata is None:\n            raise ValueError(\"Metadata cannot be done for procedural memory.\")\n\n        metadata = {**metadata, \"memory_type\": MemoryType.PROCEDURAL.value}\n        embeddings = self.embedding_model.embed(procedural_memory, memory_action=\"add\")\n        memory_id = self._create_memory(procedural_memory, {procedural_memory: embeddings}, metadata=metadata)\n        capture_event(\"mem0._create_procedural_memory\", self, {\"memory_id\": memory_id, \"sync_type\": \"sync\"})\n\n        result = {\"results\": [{\"id\": memory_id, \"memory\": procedural_memory, \"event\": \"ADD\"}]}\n\n        return result\n\n    def _update_memory(self, memory_id, data, existing_embeddings, metadata=None):\n        logger.info(f\"Updating memory with {data=}\")\n\n        try:\n            existing_memory = self.vector_store.get(vector_id=memory_id)\n        except Exception:\n            # Backing-store failure, not a bad memory_id: re-raise the original so the REST layer maps it to 5xx, not 4xx.\n            logger.error(f\"Error getting memory with ID {memory_id} during update.\")","sourceCodeStart":2003,"sourceCodeEnd":2039,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/memory/main.py#L2003-L2039","documentation":"Error \"Metadata cannot be done for procedural memory.\" thrown in mem0ai/mem0.","triggerScenarios":"Thrown at mem0/memory/main.py:2021 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not pass metadata for procedural memories; metadata updates are only supported for semantic memories."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}