Graphify-Labs/graphify · error · SystemExit
ERROR: refused to shrink graphify-out/graph.json (existing g
Error message
ERROR: refused to shrink graphify-out/graph.json (existing graph has more nodes; #479).
What it means
Shrink-guard (#479) at the graphify export step. to_json() declines to overwrite an existing larger graphify-out/graph.json with a smaller graph, returning False; this wrapper reports the ERROR and exits 1 without writing the report or analysis sidecar, preserving artifact consistency (#1392).
Source
Thrown at tools/skillgen/expected/graphify__skill-pi.md:437
raise SystemExit(1)
communities = cluster(G)
cohesion = score_all(G, communities)
tokens = {'input': extraction.get('input_tokens', 0), 'output': extraction.get('output_tokens', 0)}
gods = god_nodes(G)
surprises = surprising_connections(G, communities)
labels = {cid: 'Community ' + str(cid) for cid in communities}
# Placeholder questions - regenerated with real labels in Step 5
questions = suggest_questions(G, communities, labels)
# Export FIRST and honor the #479 shrink-guard: to_json returns False (writing
# nothing) when the new graph is smaller than the existing graph.json. Only write
# GRAPH_REPORT.md + the analysis sidecar when the graph was actually written, so
# they never describe a graph that graph.json doesn't contain (#1392).
wrote = to_json(G, communities, 'graphify-out/graph.json')
if not wrote:
print('ERROR: refused to shrink graphify-out/graph.json (existing graph has more nodes; #479).')
print('If this shrink is intentional (you deleted files), re-run a full build with --force.')
raise SystemExit(1)
report = generate(G, communities, cohesion, labels, gods, surprises, detection, tokens, 'INPUT_PATH', suggested_questions=questions)
Path('graphify-out/GRAPH_REPORT.md').write_text(report, encoding=\"utf-8\")
analysis = {
'communities': {str(k): v for k, v in communities.items()},
'cohesion': {str(k): v for k, v in cohesion.items()},
'gods': gods,
'surprises': surprises,
'questions': questions,
}
Path('graphify-out/.graphify_analysis.json').write_text(json.dumps(analysis, indent=2, ensure_ascii=False), encoding=\"utf-8\")
print(f'Graph: {G.number_of_nodes()} nodes, {G.number_of_edges()} edges, {len(communities)} communities')
"
```
If this step prints `ERROR: Graph is empty`, stop and tell the user what happened - do not proceed to labeling or visualization.
Replace INPUT_PATH with the actual path.
View on GitHub (pinned to 7fe58b0b0f)
Solutions
- Intentional shrink: full rebuild with --force.
- Match INPUT_PATH to the original root.
- Diff node counts to find losses.
- Clean rebuild if graphify-out/ is stale.
Defensive patterns
Strategy: validation
Validate before calling
import json
from pathlib import Path
existing = Path('graphify-out/graph.json')
if existing.exists():
old = len(json.loads(existing.read_text(encoding='utf-8')).get('nodes', []))
if G.number_of_nodes() < old:
raise SystemExit('shrink refused - use --force full rebuild') Prevention
- Use --force when shrinking on purpose.
- Keep INPUT_PATH stable.
- Never ignore a False from to_json().
- Rebuild clean after major corpus changes.
When it happens
Trigger: to_json(G, communities, 'graphify-out/graph.json') returning False because the rebuilt graph has fewer nodes than the stored one.
Common situations: Rebuild after file deletions; smaller build root than before; extraction dropping files; stale graph.json.
Related errors
- ERROR: refused to shrink graphify-out/graph.json (existing g
- ERROR: refused to shrink graphify-out/graph.json (existing g
- ERROR: refused to shrink graphify-out/graph.json (fewer node
- ERROR: refused to shrink graphify-out/graph.json (existing g
- ERROR: refused to shrink graphify-out/graph.json (existing g
AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14).
Data as JSON: /api/errors/b0713b3c83f919c1.
Report an issue: GitHub.