{"record":{"id":"467953120340f04d","repo":"apache/maven","slug":"missing-function-requires-exactly-one-argument","errorCode":null,"errorMessage":"missing function requires exactly one argument","messagePattern":"missing function requires exactly one argument","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionFunctions.java","lineNumber":219,"sourceCode":"        if (args.size() != 1) {\n            throw new IllegalArgumentException(\"exists function requires exactly one argument\");\n        }\n        String path = ConditionParser.toString(args.get(0));\n        return context.exists(path, true);\n    }\n\n    /**\n     * Checks if a file or directory is missing at the given path.\n     *\n     * @param args A list containing a single string argument representing the path\n     * @return {@code true} if the file or directory does not exist, {@code false} otherwise\n     * @throws IllegalArgumentException if the number of arguments is not exactly one\n     * @throws ModelBuilderException if a problem occurs while walking the file system\n     * @throws InterpolatorException if an error occurs during interpolation\n     */\n    public Object missing(List<Object> args) {\n        if (args.size() != 1) {\n            throw new IllegalArgumentException(\"missing function requires exactly one argument\");\n        }\n        String path = ConditionParser.toString(args.get(0));\n        return !context.exists(path, true);\n    }\n\n    /**\n     * Checks if a version is within a specified version range.\n     *\n     * @param args A list containing two strings: the version to check and the version range\n     * @return true if the version is within the range, false otherwise\n     * @throws IllegalArgumentException if the number of arguments is not exactly two\n     */\n    public Object inrange(List<Object> args) {\n        if (args.size() != 2) {\n            throw new IllegalArgumentException(\"inrange function requires exactly two arguments\");\n        }\n        String version = ConditionParser.toString(args.get(0));\n        String range = ConditionParser.toString(args.get(1));","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionFunctions.java#L201-L237","documentation":"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.","triggerScenarios":"A condition like missing() with no path or missing('a', 'b') with two — the valid form is missing('marker.file'), the negation of exists().","commonSituations":"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.","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"],"exampleFix":"<!-- before -->\n<condition>missing('marker.file', 'other.file')</condition>\n\n<!-- after -->\n<condition>missing('marker.file') or missing('other.file')</condition>","handlingStrategy":"validation","validationCode":"static boolean arityOk(String condition, String fn, int min, int max) {\n    int i = condition.indexOf(fn + \"(\");\n    if (i < 0) return true;\n    String args = condition.substring(i + fn.length() + 1, condition.indexOf(')', i));\n    int n = args.isBlank() ? 0 : args.split(\",\", -1).length;\n    return n >= min && n <= max;\n}\nboolean ok = arityOk(condition, \"missing\", 1, 1);","typeGuard":null,"tryCatchPattern":"try {\n    Object r = new ConditionParser(functions, resolver).parse(condition);\n} catch (IllegalArgumentException e) {\n    // report and treat the profile as inactive\n}","preventionTips":["missing is the exact negation of exists and takes exactly one path","Use missing('file') rather than not(exists('file')) for readability"],"tags":["maven","profile-activation","condition-functions","argument-mismatch","file-check"],"backgroundTag":"invalid-function-arguments","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}