flowable/flowable-engine · error · FlowableIllegalArgumentException
Cannot convert value of type ${value.getClass()} to Jackson
Error message
Cannot convert value of type ${value.getClass()} to Jackson 3 JsonNode What it means
JsonUtil.asJsonNode converts a Java value into a Jackson 3 JsonNode. When the value's type is not convertible (and allowOtherTypes is false, meaning null is not an acceptable outcome), it throws this FlowableIllegalArgumentException naming the offending runtime type.
Source
Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/JsonUtil.java:134
} else if (jackson2JsonNode.isTextual()) {
return StringNode.valueOf(jackson2JsonNode.textValue());
} else if (jackson2JsonNode.isNumber()) {
return objectMapper.valueToTree(jackson2JsonNode.numberValue());
} else if (jackson2JsonNode.isBoolean()) {
return objectMapper.valueToTree(jackson2JsonNode.booleanValue());
} else if (jackson2JsonNode.isMissingNode()) {
return MissingNode.getInstance();
}
String jsonString = jackson2JsonNode.toString();
return objectMapper.readTree(jsonString);
}
}
if (allowOtherTypes) {
return null;
}
throw new FlowableIllegalArgumentException("Cannot convert value of type " + value.getClass() + " to Jackson 3 JsonNode");
}
public static Object deepCopyIfJson(Object value) {
if (value instanceof JsonNode jsonNode) {
return jsonNode.deepCopy();
} else if (JACKSON_2_PRESENT) {
if (value instanceof com.fasterxml.jackson.databind.JsonNode jsonNode) {
return jsonNode.deepCopy();
}
}
return value;
}
public static boolean isArrayNode(Object value) {
if (value instanceof ArrayNode) {
return true;
}View on GitHub (pinned to d6d39ce1c6)
Solutions
- Check the reported type in the message and convert it to a supported JSON type (String, Number, Boolean, Map, List, JsonNode) before calling asJsonNode.
- For POJOs, serialize with an ObjectMapper first (mapper.valueToTree(pojo)) and pass the resulting JsonNode.
- Convert java.util.Date/Calendar values to ISO-8601 strings or epoch millis.
- If null is acceptable for non-convertible types, use the allowOtherTypes=true variant.
- Audit process variables for custom classes that no longer convert under Jackson 3.
Example fix
// before
JsonNode node = JsonUtil.asJsonNode(myDate);
// after
JsonNode node = JsonUtil.asJsonNode(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(myDate)); Defensive patterns
Strategy: type-guard
Validate before calling
if (value == null || value instanceof JsonNode || value instanceof String || value instanceof Number || value instanceof Boolean || value instanceof Map || value instanceof Collection) {
// safe to convert
} Type guard
static boolean isJsonConvertible(Object v) {
return v instanceof JsonNode || v instanceof String || v instanceof Number
|| v instanceof Boolean || v instanceof Map || v instanceof Collection;
} Try / catch
try {
JsonNode node = JsonUtil.asJsonNode(value);
} catch (FlowableIllegalArgumentException e) {
JsonNode node = objectMapper.valueToTree(value); // fallback to full serialization
} Prevention
- Store only JSON-friendly types in process variables
- Pre-convert POJOs and dates with an ObjectMapper before JSON conversion
- After Jackson 2→3 upgrades, re-test all variable serialization paths
When it happens
Trigger: Passing a non-JSON-convertible object (e.g. an arbitrary POJO, Date, or custom type) to JsonUtil.asJsonNode(value) or to an overload where allowOtherTypes is false and the value is not a JsonNode, primitive wrapper, String, Map, Collection, or similar supported type.
Common situations: Variable values stored in process variables (e.g. a Date or custom bean) being converted to JSON for REST/serialization; upgrading from Jackson 2 to Jackson 3 where type support changed; passing untyped Object variables.
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
- Converter can only convert com.fasterxml.jackson.databind.Js
- Unsupported value type ${value == null ? "null" : value.getC
- Unsupported value type " + (value == null ? "null" : value.g
- Cannot aggregate overview variable: ${varInstance}
- Cannot aggregate variable: ${varInstance}
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/8dbc9d9a20644b6b.
Report an issue: GitHub.