apache/flink · error · IllegalArgumentException
Value for configuration key='${key}' is not set correctly. E
Error message
Value for configuration key='${key}' is not set correctly. Entered value='${val}'. Default value='${defaultValue}' What it means
Thrown by PropertiesUtil.getInt when a properties value exists but cannot be parsed as an int via Integer.parseInt. The library treats malformed numeric configuration as an illegal argument rather than silently falling back to the default, so typos fail fast. The message names the offending key, the entered value, and the default that would have applied.
Source
Thrown at flink-core/src/main/java/org/apache/flink/util/PropertiesUtil.java:44
public class PropertiesUtil {
/**
* Get integer from properties. This method throws an exception if the integer is not valid.
*
* @param config Properties
* @param key key in Properties
* @param defaultValue default value if value is not set
* @return default or value of key
*/
public static int getInt(Properties config, String key, int defaultValue) {
String val = config.getProperty(key);
if (val == null) {
return defaultValue;
} else {
try {
return Integer.parseInt(val);
} catch (NumberFormatException nfe) {
throw new IllegalArgumentException(
"Value for configuration key='"
+ key
+ "' is not set correctly. "
+ "Entered value='"
+ val
+ "'. Default value='"
+ defaultValue
+ "'");
}
}
}
/**
* Get long from properties. This method throws an exception if the long is not valid.
*
* @param config Properties
* @param key key in Properties
* @param defaultValue default value if value is not setView on GitHub (pinned to 2f3c205e92)
Solutions
- Correct the value for the named key so it is a valid signed 32-bit integer (e.g. "16" instead of "16 cores").
- If the value should carry a unit or size, switch to the appropriate parser such as MemorySize.parse for memory or TimeUtils.parseDuration for time instead of getInt.
- Remove the key from the properties entirely if you want the defaultValue to apply.
- Trim/normalize the properties file before parsing if stray whitespace or invisible characters are suspected.
Example fix
# before job.parallelism=8x # after job.parallelism=8
Defensive patterns
Strategy: validation
Validate before calling
String raw = props.getProperty(key);
if (raw != null) {
try { Integer.parseInt(raw.trim()); }
catch (NumberFormatException e) { throw new IllegalStateException("Bad int for " + key + ": " + raw, e); }
} Prevention
- Run a config-validation pass over user-supplied Properties before handing them to PropertiesUtil.
- Keep numeric keys free of units and separators; use dedicated parsers for sizes and durations.
- Log the offending key/value at load time to fail with context in CI.
When it happens
Trigger: Calling PropertiesUtil.getInt(properties, key, defaultValue) where properties contains a non-integer string for key, e.g. "abc", "10mb", "1.5", an empty string, or a value with whitespace.
Common situations: Hand-edited flink-conf style properties files, unit placeholders in a numeric field ("512mb" in a slot/count field), locale-dependent decimal input, trailing spaces or BOM characters in properties files loaded from disk.
Related errors
- Unsupported serializer type %s for %s
- negative duration is not supported
- argument is an empty- or whitespace-only string
- Not allowed configuration change(s) were detected:\n - {erro
- At least one trigger condition must be configured.
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/177fb487ea1a3d32.
Report an issue: GitHub.