apache/maven · error · RuntimeException

Mismatched parentheses: missing closing parenthesis

Error message

Mismatched parentheses: missing closing parenthesis

What it means

Error "Mismatched parentheses: missing closing parenthesis" thrown in apache/maven.

Source

Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionParser.java:413

     */
    private Object parseFunction() {
        String functionName = tokens.get(current);
        current++;
        List<Object> args = parseArgumentList();
        return functions.get(functionName).apply(args);
    }

    /**
     * Parses an expression within parentheses.
     *
     * @return the result of parsing the expression within parentheses
     * @throws RuntimeException if there's a mismatch in parentheses
     */
    private Object parseParentheses() {
        current++; // Skip the opening parenthesis
        Object result = parseLogicalOr();
        if (current >= tokens.size() || !tokens.get(current).equals(")")) {
            throw new RuntimeException("Mismatched parentheses: missing closing parenthesis");
        }
        current++; // Skip the closing parenthesis
        return result;
    }

    /**
     * Adds two objects, handling string concatenation and numeric addition.
     *
     * @param left the left operand
     * @param right the right operand
     * @return the result of the addition
     * @throws RuntimeException if the operands cannot be added
     */
    private static Object add(Object left, Object right) {
        if (left instanceof String || right instanceof String) {
            return toString(left) + toString(right);
        } else if (left instanceof Number leftNumber && right instanceof Number rightNumber) {
            return leftNumber.doubleValue() + rightNumber.doubleValue();

View on GitHub (pinned to e4093d4e12)

When it happens

Trigger: Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionParser.java:413 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/0eafd293b140b35b. Report an issue: GitHub.