apache/maven · error · RuntimeException
Cannot add ${left} and ${right}
Error message
Cannot add ${left} and ${right} What it means
Error "Cannot add ${left} and ${right}" thrown in apache/maven.
Source
Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionParser.java:433
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();
} 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);
}
/**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:433 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/514ee6bef822cbff.
Report an issue: GitHub.