flowable/flowable-engine · error · ELException

error.negate

error.negate

Error message

error.negate

What it means

NumberOperations.neg applies unary minus to an EL operand. After attempting coercion to known numeric types (Long, Double, ... Short, Byte), if the value's type is not supported it throws an ELException with 'error.negate' naming the value's class.

Source

Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/de/odysseus/el/misc/NumberOperations.java:178

		if (value instanceof String) {
			if (isDotEe((String)value)) {
				return Double.valueOf(-converter.convert(value, Double.class).doubleValue());
			}
			return Long.valueOf(-converter.convert(value, Long.class).longValue());
		}
		if (value instanceof Long) {
			return Long.valueOf(-((Long)value).longValue());
		}
		if (value instanceof Integer) {
			return Integer.valueOf(-((Integer)value).intValue());
		}
		if (value instanceof Short) {
			return Short.valueOf((short)-((Short)value).shortValue());
		}
		if (value instanceof Byte) {
			return Byte.valueOf((byte)-((Byte)value).byteValue());
		}
		throw new ELException(LocalMessages.get("error.negate", value.getClass()));
	}
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Ensure the negated operand is a numeric type (Integer, Long, Double, Float, Short, Byte, BigInteger, BigDecimal).
  2. Convert non-numeric values explicitly in the expression or in the bean (e.g. expose a numeric getter).
  3. Register/extend a TypeConverter so the value can be coerced to a number before negation.

Example fix

// before: #{-flag} where flag is Boolean
// after: expose count and use #{-count} where count is int
// or: #{0 - someNumber} on a numeric property
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(value instanceof Number)) {
    throw new IllegalArgumentException("unary minus requires a numeric operand, got: " + (value == null ? "null" : value.getClass().getName()));
}

Type guard

boolean isNumericOperand(Object o) {
    return o instanceof Number;
}

Try / catch

try {
    Object r = NumberOperations.neg(converter, value);
} catch (ELException e) {
    // operand not numeric; coerce to a number before negating
}

Prevention

When it happens

Trigger: Evaluating a unary minus expression like -x where x is neither a number nor coercible to one (e.g. a String that is not numeric, a boolean, or a POJO).

Common situations: Negating a non-numeric bean property in an expression; property type changed from a number to String/Boolean; passing BigDecimal-like custom types not handled by the converter.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/4b9fd8b9f8b17aeb. Report an issue: GitHub.