apache/maven · error · RuntimeException

Cannot subtract ${right} from ${left}

Error message

Cannot subtract ${right} from ${left}

What it means

Error "Cannot subtract ${right} from ${left}" thrown in apache/maven.

Source

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

        if (value instanceof Number number) {
            return -number.doubleValue();
        }
        throw new RuntimeException("Cannot negate non-numeric value: " + value);
    }

    /**
     * Subtracts the right operand from the left operand.
     *
     * @param left the left operand
     * @param right the right operand
     * @return the result of the subtraction
     * @throws RuntimeException if the operands cannot be subtracted
     */
    private static Object subtract(Object left, Object right) {
        if (left instanceof Number leftNumber && right instanceof Number rightNumber) {
            return leftNumber.doubleValue() - rightNumber.doubleValue();
        } else {
            throw new RuntimeException("Cannot subtract " + right + " from " + left);
        }
    }

    /**
     * Multiplies two numeric operands.
     *
     * @param left the left operand
     * @param right the right operand
     * @return the result of the multiplication
     * @throws RuntimeException if the operands cannot be multiplied
     */
    private static Object multiply(Object left, Object right) {
        if (left instanceof Number leftNumber && right instanceof Number rightNumber) {
            return leftNumber.doubleValue() * rightNumber.doubleValue();
        } else {
            throw new RuntimeException("Cannot multiply " + left + " and " + right);
        }
    }

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:463 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/2c64c0652ba8b5ae. Report an issue: GitHub.