Skip to content

save_semantic_cache crashes on directory-path source_file (IsADirectoryError) #655

Closed

Description

@melchiormahot

Where: graphify/cache.py:31 — file_hash calls Path.read_bytes() on p, but save_semantic_cache (around line 166) only checks p.exists() before calling save_cached. When a node's source_file resolves to a directory (e.g. a folder inside a vault corpus), p.exists() returns True, and read_bytes raises IsADirectoryError.

Version: graphify 0.4.23 (pipx-installed graphifyy package).

Reproduction:
```python
from graphify.cache import save_semantic_cache
import tempfile
from pathlib import Path

with tempfile.TemporaryDirectory() as root:
root = Path(root)
(root / "subdir").mkdir()
nodes = [{"id": "n", "label": "L", "source_file": str(root / "subdir")}]
save_semantic_cache(nodes, [], root=root) # IsADirectoryError on 0.4.23
```

Fix shape: in save_semantic_cache, replace p.exists() with p.is_file() so directory-path nodes are skipped silently. Single-line change. Surfaced during a 232-node / 389-edge run on a multi-folder corpus where a few nodes had directory-shaped source paths.

Activity

  1. added a commit that references this issue on Sep 10, 2026
    cd9814e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions