{"record":{"id":"6021031844592fd9","repo":"apache/hadoop","slug":"is-not-boolean-value","errorCode":null,"errorMessage":"{} is not boolean value","messagePattern":"(.+?) is not boolean value","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java","lineNumber":2781,"sourceCode":"    try {\n      int newSetting = adjustNewVal(\n          DFS_NAMENODE_BLOCKPLACEMENTPOLICY_MIN_BLOCKS_FOR_WRITE_DEFAULT, newValue);\n      namesystem.getBlockManager().setMinBlocksForWrite(newSetting);\n      return String.valueOf(newSetting);\n    } catch (IllegalArgumentException e) {\n      throw new ReconfigurationException(property, newValue, getConf().get(property), e);\n    }\n  }\n\n  private String reconfigureFSNamesystemLockMetricsParameters(final String property,\n      final String newVal) throws ReconfigurationException {\n    String result;\n    try {\n      switch (property) {\n      case DFS_NAMENODE_LOCK_DETAILED_METRICS_KEY: {\n        if (newVal != null && !newVal.equalsIgnoreCase(\"true\") &&\n            !newVal.equalsIgnoreCase(\"false\")) {\n          throw new IllegalArgumentException(newVal + \" is not boolean value\");\n        }\n        boolean enable = (newVal == null ?\n            DFS_NAMENODE_LOCK_DETAILED_METRICS_DEFAULT : Boolean.parseBoolean(newVal));\n        result = Boolean.toString(enable);\n        namesystem.setMetricsEnabled(enable);\n        break;\n      }\n      case DFS_NAMENODE_READ_LOCK_REPORTING_THRESHOLD_MS_KEY: {\n        long readLockReportingThresholdMs = (newVal == null ?\n            DFS_NAMENODE_READ_LOCK_REPORTING_THRESHOLD_MS_DEFAULT : Long.parseLong(newVal));\n        result = Long.toString(readLockReportingThresholdMs);\n        namesystem.setReadLockReportingThresholdMs(readLockReportingThresholdMs);\n        break;\n      }\n      case DFS_NAMENODE_WRITE_LOCK_REPORTING_THRESHOLD_MS_KEY: {\n        long writeLockReportingThresholdMs = (newVal == null ?\n            DFS_NAMENODE_WRITE_LOCK_REPORTING_THRESHOLD_MS_DEFAULT : Long.parseLong(newVal));\n        result = Long.toString(writeLockReportingThresholdMs);","sourceCodeStart":2763,"sourceCodeEnd":2799,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L2763-L2799","documentation":"The DFS_NAMENODE_LOCK_DETAILED_METRICS_KEY case of reconfigureFSNamesystemLockMetricsParameters requires dfs.namenode.lock.detailed-metrics.enabled to be null (reset to default) or case-insensitively 'true'/'false'; anything else throws IllegalArgumentException('<newVal> is not boolean value'), which the surrounding catch then wraps into a ReconfigurationException for the caller.","triggerScenarios":"`hdfs dfsadmin -reconfig namenode <addr> -set dfs.namenode.lock.detailed-metrics.enabled=<not true/false>` - e.g. 'yes', '1', 'enable', 'TRUE ' with whitespace.","commonSituations":"Enabling detailed NameNode lock metrics for latency debugging with loose boolean spellings; config management writing 'True ' with a trailing space.","solutions":["Use exactly true or false (case-insensitive, no whitespace): `-set dfs.namenode.lock.detailed-metrics.enabled=true`","Trim and validate variables in automation before sending","Pair it with the threshold keys (read/write lock reporting threshold-ms), which must be plain longs","After enabling, watch the new FSNamesystem lock metrics via the NN JMX"],"exampleFix":"# before\nhdfs dfsadmin -reconfig namenode nn1:8020 -set dfs.namenode.lock.detailed-metrics.enabled=1\n\n# after\nhdfs dfsadmin -reconfig namenode nn1:8020 -set dfs.namenode.lock.detailed-metrics.enabled=true","handlingStrategy":"validation","validationCode":"V=$(echo \"$LOCK_METRICS\" | tr -d '[:space:]')\ncase \"${V,,}\" in true|false) ;; *) echo \"need true|false\"; exit 1;; esac\nhdfs dfsadmin -reconfig namenode nn1:8020 -set dfs.namenode.lock.detailed-metrics.enabled=$V","typeGuard":"static boolean isBooleanLiteral(String s) {\n  return \"true\".equalsIgnoreCase(s) || \"false\".equalsIgnoreCase(s);\n}","tryCatchPattern":"catch (ReconfigurationException e) {\n  if (e.getCause() instanceof IllegalArgumentException\n      && e.getCause().getMessage().contains(\"not boolean\")) {\n    // retry with exactly true/false\n  }\n}","preventionTips":["Trim whitespace before sending boolean reconfig values","Ban 'yes/on/1/0' spellings in your team's reconfig helper","Group-apply lock-metrics keys and validate all values up front"],"tags":["hdfs","name-node","reconfig","metrics","lock","dfsadmin","boolean-value"],"backgroundTag":"runtime-reconfig-rejected","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}