File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,7 +117,14 @@ def finalize():
117117 warnings .append (f"Node { node_id } has no label" )
118118 except Exception as e :
119119 warnings .append (f"Error parsing node: { str (e )} " )
120-
120+
121+ # duplicate labels cause silent corruption in mkconcore.py
122+ seen = set ()
123+ for label in node_labels :
124+ if label in seen :
125+ errors .append (f"Duplicate node label: '{ label } '" )
126+ seen .add (label )
127+
121128 node_ids = {node .get ('id' ) for node in nodes if node .get ('id' )}
122129 for edge in edges :
123130 source = edge .get ('source' )
Original file line number Diff line number Diff line change @@ -309,6 +309,12 @@ def cleanup_script_files():
309309 except (IndexError , AttributeError ):
310310 logging .debug ('A node with no valid properties encountered and ignored' )
311311
312+ label_values = list (nodes_dict .values ())
313+ duplicates = {label for label in label_values if label_values .count (label ) > 1 }
314+ if duplicates :
315+ logging .error (f"Duplicate node labels found: { sorted (duplicates )} " )
316+ quit ()
317+
312318for edge in edges_text :
313319 try :
314320 data = edge .find ('data' , recursive = False )
You can’t perform that action at this time.
0 commit comments