Graphify-Labs/graphify · error · AttributeError
module 'graphify' has no attribute {name!r}
Error message
module 'graphify' has no attribute {name!r} What it means
This is not a library exception: it is an explicit fail-fast guard in the graphify skill pipeline (tools/skillgen/expected/graphify__skill-vscode.md:415). After the extraction stage writes graphify-out/.graphify_extract.json, build_from_json() turns it into a networkx graph; if that graph has zero nodes, the script prints this error and exits 1 BEFORE writing graph.json, GRAPH_REPORT.md, or the analysis sidecar. The guard exists (#1392) so an empty re-extraction can never clobber a previously good graph.
Source
Thrown at graphify/__init__.py:30
"cohesion_score": ("graphify.cluster", "cohesion_score"),
"god_nodes": ("graphify.analyze", "god_nodes"),
"surprising_connections": ("graphify.analyze", "surprising_connections"),
"suggest_questions": ("graphify.analyze", "suggest_questions"),
"generate": ("graphify.report", "generate"),
"to_json": ("graphify.export", "to_json"),
"to_html": ("graphify.export", "to_html"),
"to_svg": ("graphify.export", "to_svg"),
"to_canvas": ("graphify.export", "to_canvas"),
"to_wiki": ("graphify.wiki", "to_wiki"),
"reflect": ("graphify.reflect", "reflect"),
"save_query_result": ("graphify.ingest", "save_query_result"),
}
if name in _map:
import importlib
mod_name, attr = _map[name]
mod = importlib.import_module(mod_name)
return getattr(mod, attr)
raise AttributeError(f"module 'graphify' has no attribute {name!r}")
View on GitHub (pinned to 7fe58b0b0f)
Solutions
- Check that graphify-out/.graphify_extract.json exists and its nodes array is non-empty; if empty, re-run the extraction step on the target path.
- Verify the input path actually contains extractable text files (not only binaries) and that none of them are excluded by skip rules.
- Re-run the full build from scratch: delete graphify-out/.graphify_extract.json and .graphify_detect.json so stale empty sidecars cannot be reused.
- If extraction relies on an LLM/API step, inspect its token counts (extraction.get('input_tokens')) and logs for an upstream silent failure.
Example fix
# before: pointing at a directory with no extractable text /graphify build ./assets-bin-only # after: point at the source tree and re-extract rm graphify-out/.graphify_extract.json graphify-out/.graphify_detect.json /graphify ./src
Defensive patterns
Strategy: validation
Validate before calling
import json
from pathlib import Path
extract_path = Path('graphify-out/.graphify_extract.json')
if not extract_path.exists():
raise SystemExit('extraction sidecar missing - re-run extraction')
extract = json.loads(extract_path.read_text(encoding='utf-8'))
nodes = extract.get('nodes') or extract.get('symbols') or []
if not nodes:
raise SystemExit('extraction produced 0 nodes - fix corpus/skip rules before building')
print(f'precheck ok: {len(nodes)} nodes') Prevention
- Validate .graphify_extract.json has a non-empty nodes list before invoking the build/export step.
- Keep extraction, detection, and build steps in one pipeline so an extraction failure aborts before sidecars are written.
- Point graphify at source trees, not directories of binaries or generated artifacts.
- Delete stale extract/detect sidecars when switching INPUT_PATH so empty leftovers are never reused.
When it happens
Trigger: Running the graphify build/export step when build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED) returns a graph with G.number_of_nodes() == 0. Concrete causes: all corpus files were skipped by detection (binary-only corpus), the extractor produced no nodes/edges JSON, or .graphify_extract.json is structurally valid JSON but has an empty nodes list.
Common situations: Pointing graphify at a directory containing only images/binaries/build artifacts; a prior extraction step silently failed upstream while still writing an (empty) extract file; .gitignore or skip rules excluding every source file; running from the wrong working directory so the wrong tree is scanned.
Related errors
- Cannot read {graph_path} for incremental merge: {exc}. Delet
- ERROR: invalid JSON in {path}: {exc}
- --cargo on Python 3.10 needs tomli. Install with: pip instal
- ERROR: Graph is empty - extraction produced no nodes.
- ERROR: Graph is empty - extraction produced no nodes.
AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14).
Data as JSON: /api/errors/571c9dafba7be324.
Report an issue: GitHub.