apache/hadoop · error · IllegalArgumentException

Not a valid Boolean value for

Error message

Not a valid Boolean value for {property}

What it means

Live reconfiguration of dfs.disk.balancer.enabled in reconfDiskBalancerParameters accepts only "true" or "false" (case-insensitive); any other non-null value raises IllegalArgumentException('Not a valid Boolean value for ...') which the method wraps into ReconfigurationException. A null newVal resets to the DFS_DISK_BALANCER_ENABLED default and never fails. The old value stays in effect when the change is rejected.

Solutions

  1. Resubmit exactly true or false with no surrounding whitespace
  2. Fix the template/source that produced the value so it emits only true/false
  3. Verify with hdfs dfsadmin -reconfig datanode <dn:ipc> status that the old value survived

Example fix

// before
$ hdfs dfsadmin -reconfig datanode dn1:9867 start ... dfs.disk.balancer.enabled=1
// after
$ hdfs dfsadmin -reconfig datanode dn1:9867 start ... dfs.disk.balancer.enabled=true
Defensive patterns

Strategy: validation

Validate before calling

static boolean isDnBooleanLiteral(String v) {
  return v == null || v.equalsIgnoreCase("true") || v.equalsIgnoreCase("false");
}
if (!isDnBooleanLiteral(newVal)) throw new IllegalArgumentException("dfs.disk.balancer.enabled accepts only true/false");

Try / catch

catch (ReconfigurationException e) {
  // cause IllegalArgumentException('Not a valid Boolean value for ...'); old value retained
  LOG.warn("Rejected: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling 'hdfs dfsadmin -reconfig datanode ... start' or the reconfig JMX/HTTP API for dfs.disk.balancer.enabled with "1", "yes", "on", an empty string, or whitespace-padded values like " true" (equalsIgnoreCase fails on any extra characters).

Common situations: Turning disk balancer on/off across a fleet with scripts that use 1/0; config templates rendering booleans inconsistently per key; copy-paste from docs that show 'enable: yes'.

Related errors


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

Appendix: source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java:1035

          }
        }
      }
      LOG.info("RECONFIGURE* changed {} to {}", property, newVal);
      return result;
    } catch (IllegalArgumentException | IOException | ClassNotFoundException e) {
      throw new ReconfigurationException(property, newVal, getConf().get(property), e);
    }
  }

  private String reconfDiskBalancerParameters(String property, String newVal)
      throws ReconfigurationException {
    String result = null;
    try {
      LOG.info("Reconfiguring {} to {}", property, newVal);
      if (property.equals(DFS_DISK_BALANCER_ENABLED)) {
        if (newVal != null && !newVal.equalsIgnoreCase("true")
            && !newVal.equalsIgnoreCase("false")) {
          throw new IllegalArgumentException("Not a valid Boolean value for " + property);
        }
        boolean enable = (newVal == null ? DFS_DISK_BALANCER_ENABLED_DEFAULT :
            Boolean.parseBoolean(newVal));
        getDiskBalancer().setDiskBalancerEnabled(enable);
        result = Boolean.toString(enable);
      } else if (property.equals(DFS_DISK_BALANCER_PLAN_VALID_INTERVAL)) {
        if (newVal == null) {
          // set to default
          long defaultInterval = getConf().getTimeDuration(
              DFS_DISK_BALANCER_PLAN_VALID_INTERVAL,
              DFS_DISK_BALANCER_PLAN_VALID_INTERVAL_DEFAULT,
              TimeUnit.MILLISECONDS);
          getDiskBalancer().setPlanValidityInterval(defaultInterval);
          result = DFS_DISK_BALANCER_PLAN_VALID_INTERVAL_DEFAULT;
        } else {
          long newInterval = getConf()
              .getTimeDurationHelper(DFS_DISK_BALANCER_PLAN_VALID_INTERVAL,
                  newVal, TimeUnit.MILLISECONDS);

View on GitHub (pinned to 2add963021)