{"record":{"id":"6a18518f527ba721","repo":"apache/hadoop","slug":"not-a-valid-boolean-value-for-property","errorCode":null,"errorMessage":"Not a valid Boolean value for {property}","messagePattern":"Not a valid Boolean value for (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java","lineNumber":1035,"sourceCode":"          }\n        }\n      }\n      LOG.info(\"RECONFIGURE* changed {} to {}\", property, newVal);\n      return result;\n    } catch (IllegalArgumentException | IOException | ClassNotFoundException e) {\n      throw new ReconfigurationException(property, newVal, getConf().get(property), e);\n    }\n  }\n\n  private String reconfDiskBalancerParameters(String property, String newVal)\n      throws ReconfigurationException {\n    String result = null;\n    try {\n      LOG.info(\"Reconfiguring {} to {}\", property, newVal);\n      if (property.equals(DFS_DISK_BALANCER_ENABLED)) {\n        if (newVal != null && !newVal.equalsIgnoreCase(\"true\")\n            && !newVal.equalsIgnoreCase(\"false\")) {\n          throw new IllegalArgumentException(\"Not a valid Boolean value for \" + property);\n        }\n        boolean enable = (newVal == null ? DFS_DISK_BALANCER_ENABLED_DEFAULT :\n            Boolean.parseBoolean(newVal));\n        getDiskBalancer().setDiskBalancerEnabled(enable);\n        result = Boolean.toString(enable);\n      } else if (property.equals(DFS_DISK_BALANCER_PLAN_VALID_INTERVAL)) {\n        if (newVal == null) {\n          // set to default\n          long defaultInterval = getConf().getTimeDuration(\n              DFS_DISK_BALANCER_PLAN_VALID_INTERVAL,\n              DFS_DISK_BALANCER_PLAN_VALID_INTERVAL_DEFAULT,\n              TimeUnit.MILLISECONDS);\n          getDiskBalancer().setPlanValidityInterval(defaultInterval);\n          result = DFS_DISK_BALANCER_PLAN_VALID_INTERVAL_DEFAULT;\n        } else {\n          long newInterval = getConf()\n              .getTimeDurationHelper(DFS_DISK_BALANCER_PLAN_VALID_INTERVAL,\n                  newVal, TimeUnit.MILLISECONDS);","sourceCodeStart":1017,"sourceCodeEnd":1053,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L1017-L1053","documentation":"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.","triggerScenarios":"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).","commonSituations":"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'.","solutions":["Resubmit exactly true or false with no surrounding whitespace","Fix the template/source that produced the value so it emits only true/false","Verify with hdfs dfsadmin -reconfig datanode <dn:ipc> status that the old value survived"],"exampleFix":"// before\n$ hdfs dfsadmin -reconfig datanode dn1:9867 start ... dfs.disk.balancer.enabled=1\n// after\n$ hdfs dfsadmin -reconfig datanode dn1:9867 start ... dfs.disk.balancer.enabled=true","handlingStrategy":"validation","validationCode":"static boolean isDnBooleanLiteral(String v) {\n  return v == null || v.equalsIgnoreCase(\"true\") || v.equalsIgnoreCase(\"false\");\n}\nif (!isDnBooleanLiteral(newVal)) throw new IllegalArgumentException(\"dfs.disk.balancer.enabled accepts only true/false\");","typeGuard":null,"tryCatchPattern":"catch (ReconfigurationException e) {\n  // cause IllegalArgumentException('Not a valid Boolean value for ...'); old value retained\n  LOG.warn(\"Rejected: {}\", e.getMessage());\n}","preventionTips":["Use exactly true/false; whitespace-padded values like ' true' are rejected","Trim values in templates before submission","Centralize boolean formatting in one helper used by all reconfig tooling"],"tags":["hadoop","hdfs","datanode","reconfiguration","disk-balancer","configuration"],"backgroundTag":"invalid-boolean-config-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}