apache/maven · error · IllegalArgumentException
lower function requires exactly one argument
Error message
lower function requires exactly one argument
What it means
lower() is a built-in function of Maven 4.1 profile activation conditions (<activation><condition>). ConditionFunctions.lower throws IllegalArgumentException unless exactly one argument is supplied; the activator reports it as 'Error parsing profile activation condition' and the profile remains inactive.
Source
Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionFunctions.java:90
*/
public Object upper(List<Object> args) {
if (args.size() != 1) {
throw new IllegalArgumentException("upper function requires exactly one argument");
}
String s = ConditionParser.toString(args.get(0));
return s.toUpperCase();
}
/**
* Converts the given string to lowercase.
*
* @param args A list containing a single string argument
* @return The lowercase version of the input string
* @throws IllegalArgumentException if the number of arguments is not exactly one
*/
public Object lower(List<Object> args) {
if (args.size() != 1) {
throw new IllegalArgumentException("lower function requires exactly one argument");
}
String s = ConditionParser.toString(args.get(0));
return s.toLowerCase();
}
/**
* Returns a substring of the given string.
*
* @param args A list containing 2 or 3 arguments: the string, start index, and optionally end index
* @return The substring
* @throws IllegalArgumentException if the number of arguments is not 2 or 3
*/
public Object substring(List<Object> args) {
if (args.size() < 2 || args.size() > 3) {
throw new IllegalArgumentException("substring function requires 2 or 3 arguments");
}
String s = ConditionParser.toString(args.get(0));
int start = toInt(args.get(1));View on GitHub (pinned to e4093d4e12)
Solutions
- Rewrite the call as lower(x) with exactly one argument
- Verify with mvn help:active-profiles that the profile activates
- Keep a signature table of the condition functions handy when writing activations
Example fix
<!-- before -->
<condition>lower(${os.name}, 'en') == 'linux'</condition>
<!-- after -->
<condition>lower(${os.name}) == 'linux'</condition> Defensive patterns
Strategy: validation
Validate before calling
static boolean arityOk(String condition, String fn, int min, int max) {
int i = condition.indexOf(fn + "(");
if (i < 0) return true;
String args = condition.substring(i + fn.length() + 1, condition.indexOf(')', i));
int n = args.isBlank() ? 0 : args.split(",", -1).length;
return n >= min && n <= max;
}
boolean ok = arityOk(condition, "lower", 1, 1); Try / catch
try {
Object r = new ConditionParser(functions, resolver).parse(condition);
} catch (IllegalArgumentException e) {
// report and treat the profile as inactive
} Prevention
- lower takes exactly one string argument; no locale variant
- Review every condition you migrate from old <os>/<property> activation blocks for stray arguments
When it happens
Trigger: A condition like lower() or lower(${os.name}, 'en') — the correct form is lower(${os.name}) == 'linux' with one string argument.
Common situations: Copying a locale argument from other APIs; an editing slip leaving an empty argument list; mixing up lower with substring-style multi-argument functions.
Related errors
- length function requires exactly one argument
- upper function requires exactly one argument
- substring function requires 2 or 3 arguments
- indexOf function requires exactly two arguments
- contains function requires exactly two arguments
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/ddb2466b3bde8d03.
Report an issue: GitHub.