{"record":{"id":"276d866cd11a642a","repo":"apache/hadoop","slug":"leaf-nodes-are-not-on-the-same-level","errorCode":null,"errorMessage":"Leaf nodes are not on the same level","messagePattern":"Leaf nodes are not on the same level","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/ZombieCluster.java","lineNumber":105,"sourceCode":"      MachineNode defaultNode) {\n    Map<LoggedNetworkTopology, Integer> levelMapping = \n      new IdentityHashMap<LoggedNetworkTopology, Integer>();\n    Deque<LoggedNetworkTopology> unvisited = \n      new ArrayDeque<LoggedNetworkTopology>();\n    unvisited.add(topology);\n    levelMapping.put(topology, 0);\n    \n    // building levelMapping and determine leafLevel\n    int leafLevel = -1; // -1 means leafLevel unknown.\n    for (LoggedNetworkTopology n = unvisited.poll(); n != null; \n      n = unvisited.poll()) {\n      int level = levelMapping.get(n);\n      List<LoggedNetworkTopology> children = n.getChildren();\n      if (children == null || children.isEmpty()) {\n        if (leafLevel == -1) {\n          leafLevel = level;\n        } else if (leafLevel != level) {\n          throw new IllegalArgumentException(\n              \"Leaf nodes are not on the same level\");\n        }\n      } else {\n        for (LoggedNetworkTopology child : children) {\n          levelMapping.put(child, level + 1);\n          unvisited.addFirst(child);\n        }\n      }\n    }\n\n    /**\n     * A second-pass dfs traverse of topology tree. path[i] contains the parent\n     * of the node at level i+1.\n     */\n    Node[] path = new Node[leafLevel];\n    unvisited.add(topology);\n    for (LoggedNetworkTopology n = unvisited.poll(); n != null; \n      n = unvisited.poll()) {","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/ZombieCluster.java#L87-L123","documentation":"Error \"Leaf nodes are not on the same level\" thrown in apache/hadoop.","triggerScenarios":"ZombieCluster is built from a topology whose leaf (machine) nodes sit at different depths, so the cluster tree is malformed.","commonSituations":"See trigger scenarios.","solutions":["Check the cluster topology; ZombieCluster requires all leaves at equal depth in the rack/machine tree."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}