{"record":{"id":"e22cbde7d0514b82","repo":"apache/hadoop","slug":"the-child-is-already-under-another-node","errorCode":null,"errorMessage":"The child is already under another node:","messagePattern":"The child is already under another node:","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/Node.java","lineNumber":86,"sourceCode":"   */\n  public int getLevel() {\n    return level;\n  }\n  \n  private void checkChildren() {\n    if (children == null) {\n      children = new TreeSet<Node>();\n    }\n  }\n\n  /**\n   * Add a child node to this node.\n   * @param child The child node to be added. The child node should currently not be belong to another cluster topology.\n   * @return Boolean indicating whether the node is successfully added.\n   */\n  public synchronized boolean addChild(Node child) {\n    if (child.parent != null) {\n      throw new IllegalArgumentException(\n          \"The child is already under another node:\" + child.parent);\n    }\n    checkChildren();\n    boolean retval = children.add(child);\n    if (retval) child.parent = this;\n    return retval;\n  }\n\n  /**\n   * Does this node have any children?\n   * @return Boolean indicate whether this node has any children.\n   */\n  public synchronized boolean hasChildren() {\n    return children != null && !children.isEmpty();\n  }\n\n  /**\n   * Get the children of this node.","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/Node.java#L68-L104","documentation":"Error \"The child is already under another node:\" thrown in apache/hadoop.","triggerScenarios":"A node that already has a parent in the Rumen topology tree is added under another node, which would corrupt the tree structure.","commonSituations":"See trigger scenarios.","solutions":["Remove the node from its current parent before adding it under a new one."],"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"}