{"record":{"id":"7b53db478530865c","repo":"NousResearch/hermes-agent","slug":"path-name-not-found","errorCode":null,"errorMessage":"{path.name} not found","messagePattern":"(.+?) not found","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/learning_mutations.py","lineNumber":75,"sourceCode":"        raise IndexError(f\"memory index {global_index} out of range\")\n    if cards[global_index].get(\"source\") != source:\n        raise ValueError(\"memory node id is stale — refresh the graph\")\n    if source == \"memory\":\n        return global_index\n    return global_index - sum(1 for c in cards if c.get(\"source\") == \"memory\")\n\n\ndef _locate_memory(source: str, gidx: int) -> tuple[Path, list[str], int]:\n    \"\"\"Resolve a memory card to its file, all §-delimited entries, and local index.\n\n    Entries come from ``MemoryStore._read_file`` — the same parser the memory\n    tool uses — so journey indices stay aligned with what the graph renders.\n    \"\"\"\n    from tools.memory_tool import MemoryStore\n\n    path = _memories_dir() / _MEMORY_FILES[source]\n    if not path.exists():\n        raise ValueError(f\"{path.name} not found\")\n    chunks = MemoryStore._read_file(path)\n    local = _memory_local_index(source, gidx)\n    if not 0 <= local < len(chunks):\n        raise ValueError(\"memory node id is stale — refresh the graph\")\n    return path, chunks, local\n\n\n# ── Inspect (edit prefill) ──────────────────────────────────────────────────\n\n\ndef node_detail(node_id: str) -> dict[str, Any]:\n    \"\"\"Current content for an edit prefill. ``content`` is the full SKILL.md\n    (skills) or the raw memory chunk (memories).\"\"\"\n    try:\n        return _node_detail(node_id)\n    except (ValueError, IndexError) as exc:\n        return {\"ok\": False, \"message\": str(exc)}\n","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/agent/learning_mutations.py#L57-L93","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Create/seed the memory file first — run the memory tool once or write an initial card so memories/MEMORY.md exists.","Confirm the profile: run with the intended HERMES_HOME so _memories_dir() resolves to the profile that actually has memories.","If the file was renamed, restore the canonical name (the key from _MEMORY_FILES)."],"exampleFix":"# before\nlearning_mutations.node_detail(\"memory:user:0\")  # ValueError: USER.md not found (fresh profile)\n\n# after\nfrom pathlib import Path\nfrom agent.learning_mutations import _memories_dir\np = _memories_dir() / \"USER.md\"\nif not p.exists():\n    p.parent.mkdir(parents=True, exist_ok=True)\n    p.write_text(\"# User Memory\\n\\n§seed§\\nplaceholder card\\n\")\nlearning_mutations.node_detail(\"memory:user:0\")","handlingStrategy":"validation","validationCode":"from agent.learning_mutations import _memories_dir, _MEMORY_FILES\n\ndef memory_file_exists(source: str) -> bool:\n    return (_memories_dir() / _MEMORY_FILES[source]).exists()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Seed memories/<file> on profile initialization before exposing memory mutations.","Verify the active HERMES_HOME points at the profile that owns the memories.","Health-check the memories directory in setup/startup routines for fresh installs."],"tags":["memory","filesystem","profile"],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}