{"record":{"id":"b4fea0809861b51b","repo":"apache/hadoop","slug":"not-a-valid-boolean-value-for-property-in-reconf","errorCode":null,"errorMessage":"Not a valid Boolean value for {property} in reconfSlowPeerParameters","messagePattern":"Not a valid Boolean value for (.+?) in reconfSlowPeerParameters","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":870,"sourceCode":"        dnConf.setInitBRDelayMs(result);\n      }\n      LOG.info(\"RECONFIGURE* changed {} to {}\", property, newVal);\n      return result;\n    } catch (IllegalArgumentException e) {\n      throw new ReconfigurationException(property, newVal, getConf().get(property), e);\n    }\n  }\n\n  private String reconfSlowPeerParameters(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_DATANODE_PEER_STATS_ENABLED_KEY)) {\n        Preconditions.checkNotNull(dnConf, \"DNConf has not been initialized.\");\n        if (newVal != null && !newVal.equalsIgnoreCase(\"true\")\n            && !newVal.equalsIgnoreCase(\"false\")) {\n          throw new IllegalArgumentException(\"Not a valid Boolean value for \" + property +\n              \" in reconfSlowPeerParameters\");\n        }\n        boolean enable = (newVal == null ? DFS_DATANODE_PEER_STATS_ENABLED_DEFAULT :\n            Boolean.parseBoolean(newVal));\n        result = Boolean.toString(enable);\n        dnConf.setPeerStatsEnabled(enable);\n        if (enable) {\n          // Create if it doesn't exist, overwrite if it does.\n          peerMetrics = DataNodePeerMetrics.create(getDisplayName(), getConf());\n        }\n      } else if (property.equals(DFS_DATANODE_MIN_OUTLIER_DETECTION_NODES_KEY)) {\n        Preconditions.checkNotNull(peerMetrics, \"DataNode peer stats may be disabled.\");\n        long minNodes = (newVal == null ? DFS_DATANODE_MIN_OUTLIER_DETECTION_NODES_DEFAULT :\n            Long.parseLong(newVal));\n        result = Long.toString(minNodes);\n        peerMetrics.setMinOutlierDetectionNodes(minNodes);\n      } else if (property.equals(DFS_DATANODE_SLOWPEER_LOW_THRESHOLD_MS_KEY)) {\n        Preconditions.checkNotNull(peerMetrics, \"DataNode peer stats may be disabled.\");","sourceCodeStart":852,"sourceCodeEnd":888,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L852-L888","documentation":"DataNode.reconfSlowPeerParameters applies live reconfigurations for slow-peer metrics; for dfs.datanode.peer.stats.enabled it accepts only the literal strings \"true\" or \"false\" (case-insensitive). Any other non-null value raises IllegalArgumentException('Not a valid Boolean value for ...'), which the method wraps into a ReconfigurationException naming the property, the old value, and the new value. The DataNode keeps running with the previous setting.","triggerScenarios":"Calling DataNode.reconfigureProperty (via 'hdfs dfsadmin -reconfig datanode <dn:ipc> start', the Reconfiguration JMX bean, or the HTTP reconfig servlet) for dfs.datanode.peer.stats.enabled with values like \"1\", \"yes\", \"on\", \"enabled\", an empty string, \" true\" with leading/trailing whitespace, or an unexpanded template placeholder. A null newVal is accepted and resets to DFS_DATANODE_PEER_STATS_ENABLED_DEFAULT.","commonSituations":"Enabling slow-peer metrics on a live cluster using yes/no style booleans from internal wikis; Ambari/Cloudera Manager/Ansible templates that render booleans as 1/0 or pad whitespace; scripts that reuse client-side key names in datanode reconfig payloads.","solutions":["Resubmit with the literal true or false: hdfs dfsadmin -reconfig datanode <dnHost:ipcPort> start <nnUri> dfs.datanode.peer.stats.enabled=true","Fix the upstream template or config-management source so it emits only true or false (no 1/0, no whitespace, no units)","Confirm the DN retained the old value and is healthy: hdfs dfsadmin -reconfig datanode <dnHost:ipcPort> status"],"exampleFix":"// before\n$ hdfs dfsadmin -reconfig datanode dn1:9867 start hdfs://nn1:8020 dfs.datanode.peer.stats.enabled=yes\n// => ReconfigurationException: Could not change property ... Not a valid Boolean value for dfs.datanode.peer.stats.enabled ...\n// after\n$ hdfs dfsadmin -reconfig datanode dn1:9867 start hdfs://nn1:8020 dfs.datanode.peer.stats.enabled=true","handlingStrategy":"validation","validationCode":"static boolean isDnBooleanLiteral(String v) {\n  return v == null || v.equalsIgnoreCase(\"true\") || v.equalsIgnoreCase(\"false\");\n}\n// gate before submitting the reconfiguration\nif (!isDnBooleanLiteral(newVal)) {\n  throw new IllegalArgumentException(\"dfs.datanode.peer.stats.enabled accepts only true/false, got: \" + newVal);\n}","typeGuard":null,"tryCatchPattern":"try {\n  dn.reconfigurePropertyImpl(DFS_DATANODE_PEER_STATS_ENABLED_KEY, newVal);\n} catch (ReconfigurationException e) {\n  // message carries property + oldVal + newVal; cause is the IllegalArgumentException\n  LOG.warn(\"Reconfig rejected: {}\", e.getMessage(), e.getCause());\n}","preventionTips":["Use only the literals true/false for DataNode boolean reconfigs; 1/0/yes/on are rejected","Render booleans in config templates through a whitelist, never raw integers or nullable strings","Run 'dfsadmin -reconfig ... status' after every change to confirm it applied"],"tags":["hadoop","hdfs","datanode","reconfiguration","configuration","peer-metrics"],"backgroundTag":"invalid-boolean-config-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}