Graphify-Labs/graphify · error · KeyError
repo '{repo_tag}' not in global graph
Error message
repo '{repo_tag}' not in global graph What it means
Raised by global_remove (KeyError) when asked to remove a repo tag that is not present in the global-graph manifest. The manifest tracks which repos were merged via global_add; removing an unknown tag would be a no-op on the graph, so graphify fails fast to surface typos and stale commands instead of silently succeeding.
Source
Thrown at graphify/global_graph.py:167
manifest["repos"][repo_tag] = {
"added_at": datetime.now(timezone.utc).isoformat(),
"source_path": str(source_path.resolve()),
"node_count": added,
"edge_count": prefixed.number_of_edges(),
"source_hash": src_hash,
}
_save_manifest(manifest)
return {"repo_tag": repo_tag, "nodes_added": added, "nodes_removed": removed, "skipped": False}
def global_remove(repo_tag: str) -> int:
"""Remove all nodes for repo_tag from the global graph. Returns count removed."""
from graphify.build import prune_repo_from_graph
manifest = _load_manifest()
if repo_tag not in manifest["repos"]:
raise KeyError(f"repo '{repo_tag}' not in global graph")
G = _load_global_graph()
removed = prune_repo_from_graph(G, repo_tag)
_save_global_graph(G)
del manifest["repos"][repo_tag]
_save_manifest(manifest)
return removed
def global_list() -> dict:
"""Return the manifest repos dict."""
return _load_manifest().get("repos", {})
def global_path() -> Path:
return _GLOBAL_GRAPH
View on GitHub (pinned to 7fe58b0b0f)
Solutions
- List registered repos first: `graphify global list`, and copy the exact tag
- Re-run the remove with the exact tag spelling/case
- If the tag is genuinely gone, no action is needed — the graph is already clean for that repo
Example fix
# before graphify global remove MyRepo # KeyError: repo 'MyRepo' not in global graph # after graphify global list # shows 'myrepo' graphify global remove myrepo
Defensive patterns
Strategy: try-catch
Validate before calling
from graphify.global_graph import global_list, global_remove
repos = global_list()["repos"]
if repo_tag not in repos:
print(f"tag {repo_tag!r} not registered; known: {sorted(repos)}")
else:
removed = global_remove(repo_tag)
print(f"removed {removed} nodes") Try / catch
try:
global_remove(repo_tag)
except KeyError as e:
if repo_tag in str(e):
pass # already absent - treat as success (idempotent remove)
else:
raise Prevention
- Call global_list() and match tags exactly (case-sensitive) before remove
- Standardize repo tags in one place (env var / config) instead of typing them per command
- Make remove operations idempotent in wrappers by swallowing the 'not in global graph' KeyError
When it happens
Trigger: Calling global_remove(repo_tag) — e.g. `graphify global remove myrepo` — when repo_tag is not a key in the manifest's repos dict (never added, already removed, or misspelled).
Common situations: Misspelled or renamed tags (tag differs from the directory name when --as was used); removing twice; a fresh machine where the global manifest exists but that repo was never added; case-sensitivity mismatches in tags.
Related errors
- graph not found: {source_path}
- No git repository found at or above {path.resolve()}
- Claude Code CLI not found on $PATH
- gh CLI not found or not authenticated. Run: gh auth login
- --root {root} matched 0 of {len(by_file)} source files (sour
AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14).
Data as JSON: /api/errors/d7ce8e8198739df5.
Report an issue: GitHub.