flowable/flowable-engine · error · FlowableIllegalArgumentException

Unsupported event payload instance type: ${definitionType}

Error message

Unsupported event payload instance type: ${definitionType}

What it means

EventPayloadToJsonStringSerializer.serialize converts event payload instance values into a Jackson ObjectNode keyed by payload definition name. Each payload value's Java type must be one of the supported types (String, Number-ish types, Boolean, JsonNode, Map/List convertible types, byte[]/Date per implementation). When payloadInstance.getValue() returns an object whose runtime type is not handled by any instanceof branch, the serializer throws FlowableIllegalArgumentException naming the payload definition type.

Source

Thrown at modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/serialization/EventPayloadToJsonStringSerializer.java:133

                            jsonValue = jsonNode;
                        }
                    }
                    if (jsonValue instanceof JsonNode) {
                        objectNode.set(payloadInstance.getDefinitionName(), (JsonNode) jsonValue);
                    } else if (jsonValue instanceof String) {
                        JsonNode jsonNode;
                        try {
                            jsonNode = objectMapper.readTree((String) jsonValue);
                        } catch (JacksonException e) {
                            throw new FlowableIllegalArgumentException("Could not read json event payload", e);
                        }
                        objectNode.set(payloadInstance.getDefinitionName(), jsonNode);
                    }  else {
                        throw new FlowableIllegalArgumentException("Cannot convert event payload " + jsonValue + " to type 'json'");
                    }

                } else {
                    throw new FlowableIllegalArgumentException("Unsupported event payload instance type: " + definitionType);
                }

            } else {
                objectNode.putNull(payloadInstance.getDefinitionName());
            }
        }

        try {
            return objectMapper.writeValueAsString(objectNode);
        } catch (JacksonException e) {
            throw new FlowableException("Could not serialize event to json string for " + eventInstance, e);
        }
    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Convert the payload value to a supported type before setting it: use String, Boolean, Integer/Long/Double, JsonNode (objectMapper.valueToTree(obj)), or Map/List.
  2. If the value is a complex object, serialize it yourself to a JsonNode or JSON string payload so the json branch handles it.
  3. Log/check the failing definitionType reported in the message and compare with the instanceof branches in EventPayloadToJsonStringSerializer to see what is accepted.
  4. If you control the event definition, restrict the payload field type in the event registry model to a supported type so clients cannot set arbitrary objects.

Example fix

// before
payloadInstance.setValue(new MyCustomDto("x"));

// after
payloadInstance.setValue(objectMapper.valueToTree(new MyCustomDto("x")));
Defensive patterns

Strategy: validation

Validate before calling

Object value = payloadInstance.getValue();
boolean supported = value instanceof String || value instanceof Boolean || value instanceof Number
        || value instanceof JsonNode || value instanceof Map || value instanceof Collection;
if (!supported) {
    throw new IllegalArgumentException("Payload '" + payloadInstance.getDefinitionName()
            + "' has unsupported type: " + (value == null ? "null" : value.getClass().getName()));
}

Type guard

boolean isSupportedPayloadType(Object v) {
    return v instanceof String || v instanceof Boolean || v instanceof Number
        || v instanceof JsonNode || v instanceof Map || v instanceof Collection;
}

Try / catch

try {
    String json = serializer.serialize(eventInstance);
} catch (FlowableIllegalArgumentException e) {
    logger.warn("Unsupported payload type in event: {}", e.getMessage());
    // convert offending payload to JsonNode and retry
}

Prevention

When it happens

Trigger: Calling serialize(eventInstance) on an event whose payload value was set to an unsupported Java object (e.g. a custom POJO, BigDecimal in an unsupported path, or an enum) instead of String/Boolean/Number/JsonNode/Map/Collection, causing the instanceof chain in serialize to fall through to the final else branch.

Common situations: Developers building an InboundEventInstance or payload model programmatically and putting raw domain objects into payload values; upgrading Flowable and relying on a type that a previous version's serializer accepted; populating payloads from reflection/deserialization that yields unexpected types.

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


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