flowable/flowable-engine · error · UnsupportedOperationException
Cannot get variable value for jackson 2
Error message
Cannot get variable value for jackson 2
What it means
Jackson2JsonObjectRestVariableConverter handles Flowable JSON variables backed by Jackson's JsonNode. Its getVariableValue is intentionally unimplemented: reading a JSON variable back from a REST representation is not supported for this converter, so it always throws UnsupportedOperationException with this message.
Source
Thrown at modules/flowable-common-rest/src/main/java/org/flowable/common/rest/variable/Jackson2JsonObjectRestVariableConverter.java:48
protected ObjectMapper objectMapper;
public Jackson2JsonObjectRestVariableConverter(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
}
@Override
public String getRestTypeName() {
return "json";
}
@Override
public Class<?> getVariableType() {
return JsonNode.class;
}
@Override
public Object getVariableValue(EngineRestVariable result) {
throw new UnsupportedOperationException("Cannot get variable value for jackson 2");
}
@Override
public void convertVariableValue(Object variableValue, EngineRestVariable result) {
if (variableValue != null) {
if (!(variableValue instanceof JsonNode)) {
throw new FlowableIllegalArgumentException("Converter can only convert com.fasterxml.jackson.databind.JsonNode.");
}
tools.jackson.databind.JsonNode valueNode = objectMapper.readTree(variableValue.toString());
result.setValue(valueNode);
} else {
result.setValue(null);
}
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Do not read JSON variables through this converter; store them as plain strings and parse to JsonNode client-side.
- Upgrade to a Flowable version where JSON variable conversion via REST is supported.
- Provide a custom RestVariableConverter for JsonNode that implements getVariableValue by parsing result.getValue() with an ObjectMapper.
- Change the variable's REST type to 'string' so the string converter handles the read.
Example fix
// before JsonNode node = (JsonNode) runtimeService.getVariable(executionId, "payload"); // served via jackson2 REST converter -> throws // after String json = (String) runtimeService.getVariable(executionId, "payload"); JsonNode node = new ObjectMapper().readTree(json);
Defensive patterns
Strategy: try-catch
Validate before calling
public static boolean supportsJsonRead(RestVariableConverter c) {
try { c.getVariableValue(null); return false; } catch (UnsupportedOperationException e) { return false; } catch (Exception e) { return true; }
} Type guard
public static boolean isJacksonJsonConverter(RestVariableConverter c) { return c instanceof Jackson2JsonObjectRestVariableConverter; } Try / catch
try {
Object value = restClient.getVariable(id, "payload");
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("Cannot get variable value for jackson 2")) {
// read the variable as a string and parse to JsonNode locally
} else { throw e; }
} Prevention
- Treat Jackson 2 JSON variables as write-only through the REST API in this version.
- Store JSON as a plain string variable if you need REST read-back.
- Register a custom RestVariableConverter with a working getVariableValue for JsonNode.
- Check your Flowable version's REST JSON variable support before adopting the 'json' REST type.
When it happens
Trigger: Any REST call that resolves a variable whose REST type maps to the Jackson 2 JSON converter (getVariableType() returns JsonNode.class) and requires getVariableValue — i.e. reading a JSON-typed variable through the REST API.
Common situations: Fetching a process/task variable that was stored as a Flowable JsonNode JSON variable via the REST API; Flowable versions where JSON variable read-back was simply not wired up for Jackson 2.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Error writing form model response
- Failed to serialize to a RestVariable instance
- Failed to serialize to a RestVariable instance
- Variable name is required
- Error converting request body to RestVariable instance
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/5486b36ac82fa8ca.
Report an issue: GitHub.