apache/hadoop · error · IllegalArgumentException

Only MachineNode can be added to RackNode

Error message

Only MachineNode can be added to RackNode

What it means

Error "Only MachineNode can be added to RackNode" thrown in apache/hadoop.

Source

Thrown at hadoop-tools/hadoop-rumen/src/main/java/org/apache/hadoop/tools/rumen/RackNode.java:34

 * limitations under the License.
 */
package org.apache.hadoop.tools.rumen;

import java.util.Set;

/**
 * {@link RackNode} represents a rack node in the cluster topology.
 */
public final class RackNode extends Node {
  public RackNode(String name, int level) {
    // Hack: ensuring rack name starts with "/".
    super(name.startsWith("/") ? name : "/" + name, level);
  }
  
  @Override
  public synchronized boolean addChild(Node child) {
    if (!(child instanceof MachineNode)) {
      throw new IllegalArgumentException(
          "Only MachineNode can be added to RackNode");
    }
    return super.addChild(child);
  }
  
  /**
   * Get the machine nodes that belong to the rack.
   * @return The machine nodes that belong to the rack.
   */
  @SuppressWarnings({ "cast", "unchecked" })
  public Set<MachineNode> getMachinesInRack() {
    return (Set<MachineNode>)(Set)getChildren();
  }
}

View on GitHub (pinned to 2add963021)

Solutions

  1. Add only MachineNode instances as children of a RackNode.

When it happens

Trigger: A non-MachineNode node is added as a child of a RackNode in a Rumen topology; racks may only contain machines.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/73efd6299cae6c81. Report an issue: GitHub.