apache/maven · error · RuntimeException

Cannot negate non-numeric value: ${value}

Error message

Cannot negate non-numeric value: ${value}

What it means

Error "Cannot negate non-numeric value: ${value}" thrown in apache/maven.

Source

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

        } else if (left instanceof Number leftNumber && right instanceof Number rightNumber) {
            return leftNumber.doubleValue() + rightNumber.doubleValue();
        } else {
            throw new RuntimeException("Cannot add " + left + " and " + right);
        }
    }

    /**
     * Negates a numeric value.
     *
     * @param value the value to negate
     * @return the negated value
     * @throws RuntimeException if the value cannot be negated
     */
    private Object negate(Object value) {
        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);
        }
    }

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:448 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/87cf34cc90a8f0ad. Report an issue: GitHub.