{"record":{"id":"b5622f8195617e1e","repo":"apache/maven","slug":"invalid-threads-value-supported-are-int-and","errorCode":null,"errorMessage":"Invalid threads value: '{}'. Supported are int and float values ending with C.","messagePattern":"Invalid threads value: '(.+?)'\\. Supported are int and float values ending with C\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java","lineNumber":1649,"sourceCode":"\n                if (coreMultiplier <= 0.0f) {\n                    throw new IllegalArgumentException(\"Invalid threads core multiplier value: '\" + threadConfiguration\n                            + \"'. Value must be positive.\");\n                }\n\n                int procs = Runtime.getRuntime().availableProcessors();\n                int threads = (int) (coreMultiplier * procs);\n                return threads == 0 ? 1 : threads;\n            } else {\n                int threads = Integer.parseInt(threadConfiguration);\n                if (threads <= 0) {\n                    throw new IllegalArgumentException(\n                            \"Invalid threads value: '\" + threadConfiguration + \"'. Value must be positive.\");\n                }\n                return threads;\n            }\n        } catch (NumberFormatException e) {\n            throw new IllegalArgumentException(\"Invalid threads value: '\" + threadConfiguration\n                    + \"'. Supported are int and float values ending with C.\");\n        }\n    }\n\n    // ----------------------------------------------------------------------\n    // Properties handling\n    // ----------------------------------------------------------------------\n\n    void populateProperties(\n            CommandLine commandLine, Properties paths, Properties systemProperties, Properties userProperties)\n            throws Exception {\n\n        // ----------------------------------------------------------------------\n        // Load environment and system properties\n        // ----------------------------------------------------------------------\n\n        EnvironmentUtils.addEnvVars(systemProperties);\n        SystemProperties.addSystemProperties(systemProperties);","sourceCodeStart":1631,"sourceCodeEnd":1667,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L1631-L1667","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"# before\nmvn -T2.5 package        # float without C -> IllegalArgumentException\n\n# after\nmvn -T2.5C package","handlingStrategy":"validation","validationCode":"private static final Pattern THREADS = Pattern.compile(\"^(?:[1-9]\\\\d*|\\\\d+(?:\\\\.\\\\d+)?[Cc])$\");\nString v = argAfter(args, \"-T\", \"--threads\");\nif (v != null && !THREADS.matcher(v).matches()) {\n    throw new IllegalArgumentException(\"Bad -T value '\" + v + \"': use an int (-T4) or float+C (-T1.5C)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    mavenCli.doMain(args, ...);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Supported are int and float values ending with C\")) {\n        // re-invoke with sanitized value, e.g. strip whitespace / add C / fall back to -T1\n    }\n    throw e;\n}","preventionTips":["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."],"tags":["maven","cli","threads","parallel-build","number-parsing"],"backgroundTag":"invalid-thread-count","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}