apache/maven · error · IllegalArgumentException
Invalid threads value: '{}'. Supported are int and float val
Error message
Invalid threads value: '{}'. Supported are int and float values ending with C. What it means
This is the parse-failure branch of MavenCli.calculateDegreeOfConcurrency(): the -T value neither parsed as a float+C multiplier nor as an integer, i.e. Integer.parseInt / Float.parseFloat threw NumberFormatException, which is rethrown as IllegalArgumentException with the supported syntax. Valid forms are integers (-T4) or floats suffixed with C (-T1.5C).
Source
Thrown at compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java:1649
if (coreMultiplier <= 0.0f) {
throw new IllegalArgumentException("Invalid threads core multiplier value: '" + threadConfiguration
+ "'. Value must be positive.");
}
int procs = Runtime.getRuntime().availableProcessors();
int threads = (int) (coreMultiplier * procs);
return threads == 0 ? 1 : threads;
} else {
int threads = Integer.parseInt(threadConfiguration);
if (threads <= 0) {
throw new IllegalArgumentException(
"Invalid threads value: '" + threadConfiguration + "'. Value must be positive.");
}
return threads;
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid threads value: '" + threadConfiguration
+ "'. Supported are int and float values ending with C.");
}
}
// ----------------------------------------------------------------------
// Properties handling
// ----------------------------------------------------------------------
void populateProperties(
CommandLine commandLine, Properties paths, Properties systemProperties, Properties userProperties)
throws Exception {
// ----------------------------------------------------------------------
// Load environment and system properties
// ----------------------------------------------------------------------
EnvironmentUtils.addEnvVars(systemProperties);
SystemProperties.addSystemProperties(systemProperties);View on GitHub (pinned to e4093d4e12)
Solutions
- Use one of the two supported forms: an integer count (-T8) or a float multiplier with a trailing C (-T1.5C).
- Print the exact command line before running it in CI to spot stray characters or empty interpolations in the -T value.
- Default empty variables: -T${JOBS:-1}C rather than -T${JOBS}C.
- Use a dot as decimal separator in multipliers (-T0.5C, never -T0,5C).
Example fix
# before mvn -T2.5 package # float without C -> IllegalArgumentException # after mvn -T2.5C package
Defensive patterns
Strategy: validation
Validate before calling
private static final Pattern THREADS = Pattern.compile("^(?:[1-9]\\d*|\\d+(?:\\.\\d+)?[Cc])$");
String v = argAfter(args, "-T", "--threads");
if (v != null && !THREADS.matcher(v).matches()) {
throw new IllegalArgumentException("Bad -T value '" + v + "': use an int (-T4) or float+C (-T1.5C)");
} Try / catch
try {
mavenCli.doMain(args, ...);
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().contains("Supported are int and float values ending with C")) {
// re-invoke with sanitized value, e.g. strip whitespace / add C / fall back to -T1
}
throw e;
} Prevention
- Echo the final mvn command in CI logs so broken interpolations in -T are visible immediately.
- Remember float thread counts must carry the C suffix; without it only plain integers are valid.
- Use '.' as decimal separator; values like 1,5C always fail.
When it happens
Trigger: mvn -Tabc, mvn -T1.5 (float without the trailing C), mvn -T'4 ' (embedded whitespace), mvn -T4x, or an interpolated value that is empty/non-numeric (e.g. -T${JOBS}C where JOBS is empty yields 'C', which fails the float parse). Note that a value like -T1,5C with a locale-style comma also fails.
Common situations: Copy-pasting '2.5' style thread counts from tutorials without the C suffix. Quoting/escaping bugs in CI YAML leaving stray characters in the option value. Empty variables producing -TC or -T. Locale confusion where a decimal comma is used.
Related errors
- Invalid threads core multiplier value: '{}'. Value must be p
- Invalid threads value: '{}'. Value must be positive.
- Unbounded range: {}
- Ranges overlap: {}
- Range defies version ordering: {}
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/b5622f8195617e1e.
Report an issue: GitHub.