Graphify-Labs/graphify · error · FileNotFoundError
Graph file not found: {resolved}
Error message
Graph file not found: {resolved} What it means
Raised by the graph-path validator in graphify/security.py when a path passed the base-directory and containment checks but the resolved file does not exist on disk. It is the plain missing-file case within the otherwise-restricted graphify-out/ directory.
Source
Thrown at graphify/security.py:352
base = base.resolve()
if not base.exists():
raise ValueError(
f"Graph base directory does not exist: {base}. "
"Run /graphify first to build the graph."
)
resolved = Path(path).resolve()
try:
resolved.relative_to(base)
except ValueError:
raise ValueError(
f"Path {path!r} escapes the allowed directory {base}. "
"Only paths inside graphify-out/ are permitted."
)
if not resolved.exists():
raise FileNotFoundError(f"Graph file not found: {resolved}")
return resolved
def check_graph_file_size_cap(path: Path) -> None:
"""Reject *path* if its size exceeds the configured graph-file cap.
Protects callers from memory bombs by failing fast before a multi-GiB
graph.json is read into memory and JSON-parsed. Silently returns when
``path.stat()`` cannot be read — the caller's own existence/path check
is expected to surface a clearer error in that case.
The cap is resolved on every call via :func:`_max_graph_file_bytes`, so the
``GRAPHIFY_MAX_GRAPH_BYTES`` env var can be set before import and still
apply.
Raises:
ValueError - file size exceeds the cap. The message includes theView on GitHub (pinned to 7fe58b0b0f)
Solutions
- Rebuild the graph (/graphify) so all expected artifacts are regenerated.
- List what actually exists under graphify-out/ and adjust the requested filename.
- If a rebuild is running concurrently, retry the read after it completes.
- Check for cleaned outputs (git clean, CI caching) and restore or regenerate them.
Example fix
# before
p = resolve_graph_path("graphify-out/graph.json") # FileNotFoundError
# after: verify what exists before requesting
base = Path("graphify-out")
if not (base / "graph.json").exists():
rebuild_graph()
p = resolve_graph_path("graphify-out/graph.json") Defensive patterns
Strategy: validation
Validate before calling
def graph_file_ready(base: Path, rel: str = "graph.json") -> bool:
return (base / rel).is_file() Type guard
def graph_file_exists(path: str | Path) -> bool:
p = Path(path).resolve()
return p.suffix == ".json" and p.exists() Try / catch
try:
p = resolve_graph_path(path)
except FileNotFoundError as e:
if "Graph file not found" in str(e):
rebuild_graph() # or prompt the user to run /graphify
p = resolve_graph_path(path)
else:
raise Prevention
- Check Path(...).exists() right before requesting graph artifacts.
- Regenerate the graph after clean steps that wipe graphify-out/.
- Cache artifact paths per build, not across builds.
When it happens
Trigger: Requesting a specific artifact (e.g. graphify-out/wiki/index.md or graph.json) that has not been generated yet, requesting it after the output was cleaned, or a stale path cached from a previous build with different content.
Common situations: Querying wiki files before the wiki-generation step ran; graph output deleted by a clean/build step between runs; file name changed between graphify versions; concurrent rebuild moved/rewrote files while a query was in flight.
Related errors
- Graph file not found: {resolved}
- Graph base directory does not exist: {base}. Run /graphify f
- Path {path!r} escapes the allowed directory {base}. Only pat
- graph.json not found: {resolved_path}
- file_hash requires a file, got: {p}
AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14).
Data as JSON: /api/errors/c09954a22e6a9d3b.
Report an issue: GitHub.