NousResearch/hermes-agent · error · ValueError

{path.name} not found

Error message

{path.name} not found

What it means

ValueError from _locate_memory: the source key resolved (it is in _MEMORY_FILES) but the corresponding file under get_hermes_home()/memories/ does not exist on disk. The parser needs the real file, so a missing MEMORY.md or USER.md aborts the mutation.

Source

Thrown at agent/learning_mutations.py:75

        raise IndexError(f"memory index {global_index} out of range")
    if cards[global_index].get("source") != source:
        raise ValueError("memory node id is stale — refresh the graph")
    if source == "memory":
        return global_index
    return global_index - sum(1 for c in cards if c.get("source") == "memory")


def _locate_memory(source: str, gidx: int) -> tuple[Path, list[str], int]:
    """Resolve a memory card to its file, all §-delimited entries, and local index.

    Entries come from ``MemoryStore._read_file`` — the same parser the memory
    tool uses — so journey indices stay aligned with what the graph renders.
    """
    from tools.memory_tool import MemoryStore

    path = _memories_dir() / _MEMORY_FILES[source]
    if not path.exists():
        raise ValueError(f"{path.name} not found")
    chunks = MemoryStore._read_file(path)
    local = _memory_local_index(source, gidx)
    if not 0 <= local < len(chunks):
        raise ValueError("memory node id is stale — refresh the graph")
    return path, chunks, local


# ── Inspect (edit prefill) ──────────────────────────────────────────────────


def node_detail(node_id: str) -> dict[str, Any]:
    """Current content for an edit prefill. ``content`` is the full SKILL.md
    (skills) or the raw memory chunk (memories)."""
    try:
        return _node_detail(node_id)
    except (ValueError, IndexError) as exc:
        return {"ok": False, "message": str(exc)}

View on GitHub (pinned to c896c09c42)

Solutions

  1. Create/seed the memory file first — run the memory tool once or write an initial card so memories/MEMORY.md exists.
  2. Confirm the profile: run with the intended HERMES_HOME so _memories_dir() resolves to the profile that actually has memories.
  3. If the file was renamed, restore the canonical name (the key from _MEMORY_FILES).

Example fix

# before
learning_mutations.node_detail("memory:user:0")  # ValueError: USER.md not found (fresh profile)

# after
from pathlib import Path
from agent.learning_mutations import _memories_dir
p = _memories_dir() / "USER.md"
if not p.exists():
    p.parent.mkdir(parents=True, exist_ok=True)
    p.write_text("# User Memory\n\n§seed§\nplaceholder card\n")
learning_mutations.node_detail("memory:user:0")
Defensive patterns

Strategy: validation

Validate before calling

from agent.learning_mutations import _memories_dir, _MEMORY_FILES

def memory_file_exists(source: str) -> bool:
    return (_memories_dir() / _MEMORY_FILES[source]).exists()

Prevention

When it happens

Trigger: Calling a memory mutation on a fresh profile where the memories directory was never initialized; the file was moved/renamed outside the API; the active HERMES_HOME points at a new/empty profile.

Common situations: First run on a new machine or profile before any memory has been written; tests using a temp HERMES_HOME without seeding memories; manual deletion of the memories directory.

Related errors


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/7b53db478530865c. Report an issue: GitHub.