SECURITY.md lists this under the threat table:
| Corrupted graph.json | _load_graph() in serve.py wraps json.JSONDecodeError and prints a clear recovery message instead of crashing. |
The handler exists, but it is unreachable. In graphify/serve.py:
except (ValueError, FileNotFoundError) as exc:
print(f"error: {exc}", file=sys.stderr)
sys.exit(1)
except json.JSONDecodeError as exc:
print(f"error: graph.json is corrupted ({exc}). Re-run /graphify to rebuild.", file=sys.stderr)
sys.exit(1)
json.JSONDecodeError subclasses ValueError, so the first clause always wins:
>>> import json
>>> issubclass(json.JSONDecodeError, ValueError)
True
Observed behaviour with a truncated graph.json: users get the bare
error: Expecting value: line 1 column 1 (char 0)
instead of the intended graph.json is corrupted (...). Re-run /graphify to rebuild. This matters more than a cosmetic message, because the atomic-write and shrink-guard work in 0.9.18 explicitly treats a truncated graph.json as a state users need to recover from — and the recovery hint is exactly what never reaches them.
Suggested fix
Move the json.JSONDecodeError clause above the (ValueError, FileNotFoundError) clause.
How this was found
Static read of graphify/serve.py plus a local check of the exception hierarchy. No graphify process was run against a real corpus.
SECURITY.mdlists this under the threat table:The handler exists, but it is unreachable. In
graphify/serve.py:json.JSONDecodeErrorsubclassesValueError, so the first clause always wins:Observed behaviour with a truncated
graph.json: users get the bareinstead of the intended
graph.json is corrupted (...). Re-run /graphify to rebuild.This matters more than a cosmetic message, because the atomic-write and shrink-guard work in 0.9.18 explicitly treats a truncatedgraph.jsonas a state users need to recover from — and the recovery hint is exactly what never reaches them.Suggested fix
Move the
json.JSONDecodeErrorclause above the(ValueError, FileNotFoundError)clause.How this was found
Static read of
graphify/serve.pyplus a local check of the exception hierarchy. No graphify process was run against a real corpus.