oraios/serena · error · ValueError

Memory '{name}' matches an ignored_memory_patterns pattern a

Error message

Memory '{name}' matches an ignored_memory_patterns pattern and cannot be accessed. Use the read_file tool on the raw file path instead.

What it means

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.

Source

Thrown at src/serena/memories/memory_manager.py:65

        self._encoding = SERENA_FILE_ENCODING
        self._read_only_memory_patterns = [re.compile(pattern) for pattern in set(read_only_memory_patterns)]
        self._ignored_memory_patterns = [re.compile(pattern) for pattern in set(ignored_memory_patterns)]

    def _is_read_only_memory(self, name: str) -> bool:
        for pattern in self._read_only_memory_patterns:
            if pattern.fullmatch(name):
                return True
        return False

    def _is_ignored_memory(self, name: str) -> bool:
        for pattern in self._ignored_memory_patterns:
            if pattern.fullmatch(name):
                return True
        return False

    def _check_not_ignored(self, name: str) -> None:
        if self._is_ignored_memory(name):
            raise ValueError(
                f"Memory '{name}' matches an ignored_memory_patterns pattern and cannot be accessed. "
                f"Use the read_file tool on the raw file path instead."
            )

    def _is_global(self, name: str) -> bool:
        return name == self.GLOBAL_TOPIC or name.startswith(self.GLOBAL_TOPIC + "/")

    @classmethod
    def _sanitize_name(cls, name: str) -> str:
        """Corrects the name for common mistakes made by LLMs (``mem:`` prefix, ``.md`` suffix, OS-specific separators)."""
        name = name.removeprefix(cls._MEMORY_REF_PREFIX)
        if name.endswith(".md"):
            name = name[:-3]
        return name.replace(os.sep, "/")

    @classmethod
    def _add_reference_prefix(cls, name: str) -> str:
        name = cls._sanitize_name(name)

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. 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.
  2. Check the ignored_memory_patterns in your Serena configuration and adjust the memory name so it does not fullmatch any pattern.
  3. Remove or narrow the overly broad ignore pattern (e.g. replace .* with a specific topic) if the memory should be accessible.
  4. Choose a different memory name that falls outside the ignored patterns when writing new content.

Example fix

// before
manager.save_memory("secret/api_keys", content, is_tool_context=True)
// ValueError: ignored pattern blocks it

// after
// Option A: bypass the memory API
read_file(Path(".serena/memories/secret/api_keys.md"))
// Option B: fix the config
ignored_memory_patterns = ["scratch/.*"]  # instead of [".*"]
Defensive patterns

Strategy: validation

Validate before calling

import re
patterns = [re.compile(p) for p in ignored_memory_patterns]
if any(p.fullmatch(name) for p in patterns):
    # bypass memory API; use read_file on the raw .md path instead
    ...

Type guard

def is_accessible_memory(name: str, ignored: list[re.Pattern]) -> bool:
    return not any(p.fullmatch(name) for p in ignored)

Try / catch

try:
    content = manager.load_memory(name)
except ValueError as e:
    if "ignored_memory_patterns" in str(e):
        content = raw_read(memory_file_path(name))
    else:
        raise

Prevention

When it happens

Trigger: 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__.

Common situations: 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.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/aad04cf58ff1b56f. Report an issue: GitHub.