{"record":{"id":"aad04cf58ff1b56f","repo":"oraios/serena","slug":"memory-name-matches-an-ignored-memory-patterns","errorCode":null,"errorMessage":"Memory '{name}' matches an ignored_memory_patterns pattern and cannot be accessed. Use the read_file tool on the raw file path instead.","messagePattern":"Memory '(.+?)' matches an ignored_memory_patterns pattern and cannot be accessed\\. Use the read_file tool on the raw file path instead\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/serena/memories/memory_manager.py","lineNumber":65,"sourceCode":"        self._encoding = SERENA_FILE_ENCODING\n        self._read_only_memory_patterns = [re.compile(pattern) for pattern in set(read_only_memory_patterns)]\n        self._ignored_memory_patterns = [re.compile(pattern) for pattern in set(ignored_memory_patterns)]\n\n    def _is_read_only_memory(self, name: str) -> bool:\n        for pattern in self._read_only_memory_patterns:\n            if pattern.fullmatch(name):\n                return True\n        return False\n\n    def _is_ignored_memory(self, name: str) -> bool:\n        for pattern in self._ignored_memory_patterns:\n            if pattern.fullmatch(name):\n                return True\n        return False\n\n    def _check_not_ignored(self, name: str) -> None:\n        if self._is_ignored_memory(name):\n            raise ValueError(\n                f\"Memory '{name}' matches an ignored_memory_patterns pattern and cannot be accessed. \"\n                f\"Use the read_file tool on the raw file path instead.\"\n            )\n\n    def _is_global(self, name: str) -> bool:\n        return name == self.GLOBAL_TOPIC or name.startswith(self.GLOBAL_TOPIC + \"/\")\n\n    @classmethod\n    def _sanitize_name(cls, name: str) -> str:\n        \"\"\"Corrects the name for common mistakes made by LLMs (``mem:`` prefix, ``.md`` suffix, OS-specific separators).\"\"\"\n        name = name.removeprefix(cls._MEMORY_REF_PREFIX)\n        if name.endswith(\".md\"):\n            name = name[:-3]\n        return name.replace(os.sep, \"/\")\n\n    @classmethod\n    def _add_reference_prefix(cls, name: str) -> str:\n        name = cls._sanitize_name(name)","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/memories/memory_manager.py#L47-L83","documentation":"MemoryManager._check_not_ignored raises this ValueError when the memory name fully matches one of the regex patterns configured in ignored_memory_patterns. Ignored memories are completely excluded from listing, reading, and writing via the memory tools, by design. The user is directed to bypass the memory API and use read_file on the raw file path instead.","triggerScenarios":"Calling load_memory, save_memory, delete_memory, move_memory, or edit_memory with a name that regex-fullmatches any entry in the ignored_memory_patterns list passed to MemoryManager.__init__.","commonSituations":"A project's serena config excludes certain memories (e.g. secrets, scratch notes, auto-generated topics) via ignored_memory_patterns; an LLM agent or user then tries read_memory/write_memory on one of those names, or a pattern like .* silently blocks far more memories than intended.","solutions":["Read the memory content directly with the read_file tool on its raw path under .serena/memories/ (or the global memories dir) instead of the memory API.","Check the ignored_memory_patterns in your Serena configuration and adjust the memory name so it does not fullmatch any pattern.","Remove or narrow the overly broad ignore pattern (e.g. replace .* with a specific topic) if the memory should be accessible.","Choose a different memory name that falls outside the ignored patterns when writing new content."],"exampleFix":"// before\nmanager.save_memory(\"secret/api_keys\", content, is_tool_context=True)\n// ValueError: ignored pattern blocks it\n\n// after\n// Option A: bypass the memory API\nread_file(Path(\".serena/memories/secret/api_keys.md\"))\n// Option B: fix the config\nignored_memory_patterns = [\"scratch/.*\"]  # instead of [\".*\"]","handlingStrategy":"validation","validationCode":"import re\npatterns = [re.compile(p) for p in ignored_memory_patterns]\nif any(p.fullmatch(name) for p in patterns):\n    # bypass memory API; use read_file on the raw .md path instead\n    ...","typeGuard":"def is_accessible_memory(name: str, ignored: list[re.Pattern]) -> bool:\n    return not any(p.fullmatch(name) for p in ignored)","tryCatchPattern":"try:\n    content = manager.load_memory(name)\nexcept ValueError as e:\n    if \"ignored_memory_patterns\" in str(e):\n        content = raw_read(memory_file_path(name))\n    else:\n        raise","preventionTips":["Keep ignored_memory_patterns specific; avoid broad patterns like .*","Check the config's ignore list before programmatically accessing memories","Prefer read_file on raw paths for anything you know is ignored"],"tags":["python","memory","configuration","access-denied"],"backgroundTag":"memory-blocked-by-ignore-pattern","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}