{"record":{"id":"3c56f6de1f467a49","repo":"apache/hadoop","slug":"failed-to-parse-value-s-as-s-property-key-s","errorCode":null,"errorMessage":"Failed to parse value %s as %s, property key %s","messagePattern":"Failed to parse value (.+?) as (.+?), property key (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/util/ParseUtils.java","lineNumber":62,"sourceCode":"    return StringUtils.isEmpty(value) ? defaultValue : value;\n  }\n\n  public static boolean envAsBoolean(String key, boolean defaultValue) {\n    String value = System.getenv(key);\n    if (StringUtils.isEmpty(value)) {\n      return defaultValue;\n    }\n    checkBoolean(key, value);\n    return Boolean.parseBoolean(value);\n  }\n\n  public static boolean isBoolean(String value) {\n    return \"true\".equalsIgnoreCase(value) || \"false\".equalsIgnoreCase(value);\n  }\n\n  public static void checkBoolean(String key, String value) {\n    if (!isBoolean(value)) {\n      throw new IllegalArgumentException(String.format(ERROR_MSG, value, \"boolean\", key));\n    }\n  }\n}\n","sourceCodeStart":44,"sourceCodeEnd":66,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/util/ParseUtils.java#L44-L66","documentation":"ParseUtils.checkBoolean enforces that a configuration value is literally 'true' or 'false' (case-insensitive) before hadoop-tos parses it; otherwise it throws IllegalArgumentException('Failed to parse value %s as %s, property key %s') naming the bad value, the expected type, and the property key. The connector calls this for every fs.tos.* boolean option, so the message tells you exactly which key is malformed. Note it accepts only the two literals — 'yes', 'no', '1', '0', 'on' are all rejected despite being truthy elsewhere.","triggerScenarios":"Setting any hadoop-tos boolean configuration (fs.tos.* keys parsed via ParseUtils.getBoolean/checkBoolean) to a non-literal: '1', 'on', 'YES', 'True ' with trailing whitespace, or a value with smart quotes from copy-pasted docs. Also setting the wrong property so a default-less lookup receives a foreign string.","commonSituations":"Porting configs from other systems that accept 0/1 or on/off; XML property values polluted by whitespace/newlines or HTML-escaped quotes; typos like 'flase'; environment-variable substitution producing an empty or numeric string; docs examples using enable/disable wording.","solutions":["Set the named property to exactly true or false (any case) in core-site.xml, e.g. <value>false</value>.","Trim whitespace and remove any quotes/HTML entities from the property value.","Grep the configuration chain (core-site.xml, hdfs-site.xml, job conf, env-substituted values) for the property key printed in the message to find which source supplies the bad value.","Add a startup validation step that iterates fs.tos.* boolean keys through ParseUtils.isBoolean to fail fast with a clear message."],"exampleFix":"<!-- before -->\n<property><name>fs.tos.object.rename.enabled</name><value>1</value></property>\n\n<!-- after -->\n<property><name>fs.tos.object.rename.enabled</name><value>true</value></property>","handlingStrategy":"validation","validationCode":"String v = conf.get(key, null);\nif (v != null && !ParseUtils.isBoolean(v)) {\n  throw new IllegalArgumentException(key + \" must be true/false, got: \" + v);\n}","typeGuard":"static boolean isBooleanValue(String v) {\n  return \"true\".equalsIgnoreCase(v) || \"false\".equalsIgnoreCase(v);\n}","tryCatchPattern":null,"preventionTips":["Use only true/false literals in all fs.tos.* boolean properties.","Lint configuration files for non-literal booleans before deployment.","Watch for whitespace, quotes, and 1/0 values pasted from other systems."],"tags":["configuration","boolean-parsing","illegal-argument","hadoop-tos","core-site"],"backgroundTag":"invalid-config-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}