apache/hadoop · error · IllegalArgumentException
Failed to parse value %s as %s, property key %s
Error message
Failed to parse value %s as %s, property key %s
What it means
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.
Source
Thrown at hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/util/ParseUtils.java:62
return StringUtils.isEmpty(value) ? defaultValue : value;
}
public static boolean envAsBoolean(String key, boolean defaultValue) {
String value = System.getenv(key);
if (StringUtils.isEmpty(value)) {
return defaultValue;
}
checkBoolean(key, value);
return Boolean.parseBoolean(value);
}
public static boolean isBoolean(String value) {
return "true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value);
}
public static void checkBoolean(String key, String value) {
if (!isBoolean(value)) {
throw new IllegalArgumentException(String.format(ERROR_MSG, value, "boolean", key));
}
}
}
View on GitHub (pinned to 2add963021)
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.
Example fix
<!-- before --> <property><name>fs.tos.object.rename.enabled</name><value>1</value></property> <!-- after --> <property><name>fs.tos.object.rename.enabled</name><value>true</value></property>
Defensive patterns
Strategy: validation
Validate before calling
String v = conf.get(key, null);
if (v != null && !ParseUtils.isBoolean(v)) {
throw new IllegalArgumentException(key + " must be true/false, got: " + v);
} Type guard
static boolean isBooleanValue(String v) {
return "true".equalsIgnoreCase(v) || "false".equalsIgnoreCase(v);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- No scheme in default FS: ${uri}
- maxRetries = ${maxRetries} < 0
- sleepTime = ${sleepTime} < 0
- numRetries = ${numRetries} < 0
- sleepMillis = ${sleepMillis} < 0
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/3c56f6de1f467a49.
Report an issue: GitHub.