flowable/flowable-engine · error · FlowableEventJsonException
Error writing event json
Error message
Error writing event json
What it means
EventJsonConverter.convertToJson serializes an EventModel (including payload and extension properties) into its JSON string. A failure in objectMapper.writeValueAsString is wrapped as FlowableEventJsonException('Error writing event json'). It indicates the event model cannot be represented as JSON.
Solutions
- Inspect the cause exception to identify which model field/property fails serialization.
- Fix the EventModel: remove or type-correct the offending payload/extension property values.
- Ensure the ObjectMapper used (from the supplier) is correctly configured for the model classes.
Example fix
// before
String json = converter.convertToJson(eventModel); // throws on bad extension property
// after
EventPayload payload = eventModel.getPayload();
payload.getExtensionProperties().remove("brokenProperty");
String json = converter.convertToJson(eventModel); Defensive patterns
Strategy: try-catch
Validate before calling
if (eventModel == null || eventModel.getKey() == null) {
throw new IllegalArgumentException("EventModel and its key must be set before serializing");
} Type guard
boolean isSerializable(EventModel m) {
return m != null && m.getKey() != null && !m.getKey().isEmpty();
} Try / catch
try {
String json = converter.convertToJson(eventModel);
} catch (FlowableEventJsonException e) {
LOG.error("Failed to serialize event model: {}", e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
throw e;
} Prevention
- Ensure payloads and extension properties contain Jackson-serializable values.
- Test round-trip convertToEventModel/convertToJson in unit tests.
- Verify the ObjectMapper configuration matches the model classes in use.
When it happens
Trigger: Calling convertToJson with an EventModel holding unserializable field values (e.g. problematic extension property nodes), or an ObjectMapper failure writing the ObjectNode tree.
Common situations: Custom EventModel subclasses with fields Jackson cannot serialize, corrupt in-memory model built programmatically, or ObjectMapper configuration issues when caching event definitions.
Understand the failure class
Background: json.Marshal / "failed to marshal" errors in Go: why "unsupported type" happens and how to fix it — this error's family across 22 libraries.
Related errors
- An error occurs converting output value as JSon
- Cannot convert event payload
- Could not read json event payload
- Error reading event json
- Error writing app model to json
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/5f449dc1161cb0c2.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-event-registry-json-converter/src/main/java/org/flowable/eventregistry/json/converter/EventJsonConverter.java:146
}
if (eventPayload.isMetaParameter()) {
eventPayloadNode.put("metaParameter", true);
}
if (eventPayload.getExtensionProperties() != null && !eventPayload.getExtensionProperties().isEmpty()) {
ObjectNode extensionPropNode = eventPayloadNode.putObject("extensionProperties");
for (String propName : eventPayload.getExtensionProperties().keySet()) {
extensionPropNode.put(propName, eventPayload.getExtensionProperties().get(propName));
}
}
}
}
try {
return objectMapper.writeValueAsString(modelNode);
} catch (Exception e) {
throw new FlowableEventJsonException("Error writing event json", e);
}
}
protected void processExtensionProperties(JsonNode node, EventPayload payload) {
JsonNode extensionNodes = node.path("extensionProperties");
if (extensionNodes != null && !extensionNodes.isMissingNode()) {
Map<String, String> extensionPropertyMap = new HashMap<>();
for (String extensionName : extensionNodes.propertyNames()) {
extensionPropertyMap.put(extensionName, extensionNodes.get(extensionName).asString());
}
payload.setExtensionProperties(extensionPropertyMap);
}
}
}View on GitHub (pinned to d6d39ce1c6)