apache/maven · error · IllegalArgumentException
missing function requires exactly one argument
Error message
missing function requires exactly one argument
What it means
missing() is a built-in function of Maven 4.1 profile activation conditions (<activation><condition>). ConditionFunctions.missing throws IllegalArgumentException unless exactly one string argument (a path, globs allowed) is given; the activator records 'Error parsing profile activation condition' and the profile stays inactive.
Source
Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionFunctions.java:219
if (args.size() != 1) {
throw new IllegalArgumentException("exists function requires exactly one argument");
}
String path = ConditionParser.toString(args.get(0));
return context.exists(path, true);
}
/**
* Checks if a file or directory is missing at the given path.
*
* @param args A list containing a single string argument representing the path
* @return {@code true} if the file or directory does not exist, {@code false} otherwise
* @throws IllegalArgumentException if the number of arguments is not exactly one
* @throws ModelBuilderException if a problem occurs while walking the file system
* @throws InterpolatorException if an error occurs during interpolation
*/
public Object missing(List<Object> args) {
if (args.size() != 1) {
throw new IllegalArgumentException("missing function requires exactly one argument");
}
String path = ConditionParser.toString(args.get(0));
return !context.exists(path, true);
}
/**
* Checks if a version is within a specified version range.
*
* @param args A list containing two strings: the version to check and the version range
* @return true if the version is within the range, false otherwise
* @throws IllegalArgumentException if the number of arguments is not exactly two
*/
public Object inrange(List<Object> args) {
if (args.size() != 2) {
throw new IllegalArgumentException("inrange function requires exactly two arguments");
}
String version = ConditionParser.toString(args.get(0));
String range = ConditionParser.toString(args.get(1));View on GitHub (pinned to e4093d4e12)
Solutions
- Use exactly one argument: missing('marker.file')
- For several paths, combine: missing('a') or missing('b')
- Prefer the single-purpose form: if you need 'file exists', use exists() instead of not(missing(...)) chaining
Example fix
<!-- before -->
<condition>missing('marker.file', 'other.file')</condition>
<!-- after -->
<condition>missing('marker.file') or missing('other.file')</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, "missing", 1, 1); Try / catch
try {
Object r = new ConditionParser(functions, resolver).parse(condition);
} catch (IllegalArgumentException e) {
// report and treat the profile as inactive
} Prevention
- missing is the exact negation of exists and takes exactly one path
- Use missing('file') rather than not(exists('file')) for readability
When it happens
Trigger: A condition like missing() with no path or missing('a', 'b') with two — the valid form is missing('marker.file'), the negation of exists().
Common situations: Leaving an empty argument list while scaffolding the condition; listing several files instead of combining with 'or'; copy-paste from exists() where an extra flag argument was already wrong.
Related errors
- exists function requires exactly one argument
- length function requires exactly one argument
- upper function requires exactly one argument
- lower function requires exactly one argument
- substring function requires 2 or 3 arguments
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/467953120340f04d.
Report an issue: GitHub.