{"record":{"id":"d7ce8e8198739df5","repo":"Graphify-Labs/graphify","slug":"repo-repo-tag-not-in-global-graph","errorCode":null,"errorMessage":"repo '{repo_tag}' not in global graph","messagePattern":"repo '(.+?)' not in global graph","errorType":"exception","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"graphify/global_graph.py","lineNumber":167,"sourceCode":"    manifest[\"repos\"][repo_tag] = {\n        \"added_at\": datetime.now(timezone.utc).isoformat(),\n        \"source_path\": str(source_path.resolve()),\n        \"node_count\": added,\n        \"edge_count\": prefixed.number_of_edges(),\n        \"source_hash\": src_hash,\n    }\n    _save_manifest(manifest)\n\n    return {\"repo_tag\": repo_tag, \"nodes_added\": added, \"nodes_removed\": removed, \"skipped\": False}\n\n\ndef global_remove(repo_tag: str) -> int:\n    \"\"\"Remove all nodes for repo_tag from the global graph. Returns count removed.\"\"\"\n    from graphify.build import prune_repo_from_graph\n\n    manifest = _load_manifest()\n    if repo_tag not in manifest[\"repos\"]:\n        raise KeyError(f\"repo '{repo_tag}' not in global graph\")\n\n    G = _load_global_graph()\n    removed = prune_repo_from_graph(G, repo_tag)\n    _save_global_graph(G)\n\n    del manifest[\"repos\"][repo_tag]\n    _save_manifest(manifest)\n    return removed\n\n\ndef global_list() -> dict:\n    \"\"\"Return the manifest repos dict.\"\"\"\n    return _load_manifest().get(\"repos\", {})\n\n\ndef global_path() -> Path:\n    return _GLOBAL_GRAPH\n","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/Graphify-Labs/graphify/blob/7fe58b0b0f3873be9a21c30106b8b8527c353aa6/graphify/global_graph.py#L149-L185","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before\ngraphify global remove MyRepo   # KeyError: repo 'MyRepo' not in global graph\n\n# after\ngraphify global list             # shows 'myrepo'\ngraphify global remove myrepo","handlingStrategy":"try-catch","validationCode":"from graphify.global_graph import global_list, global_remove\n\nrepos = global_list()[\"repos\"]\nif repo_tag not in repos:\n    print(f\"tag {repo_tag!r} not registered; known: {sorted(repos)}\")\nelse:\n    removed = global_remove(repo_tag)\n    print(f\"removed {removed} nodes\")","typeGuard":null,"tryCatchPattern":"try:\n    global_remove(repo_tag)\nexcept KeyError as e:\n    if repo_tag in str(e):\n        pass  # already absent - treat as success (idempotent remove)\n    else:\n        raise","preventionTips":["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"],"tags":["key-error","global-graph","cli","manifest"],"backgroundTag":null,"analyzedSha":"7fe58b0b0f3873be9a21c30106b8b8527c353aa6","analyzedAt":"2026-08-14T19:23:21.323Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}