flowable/flowable-engine · error · FlowableEventJsonException

Error writing channel json

Error message

Error writing channel json

What it means

ChannelJsonConverter.convertToJson serializes a ChannelModel to its JSON representation. Any ObjectMapper serialization failure is wrapped as FlowableEventJsonException('Error writing channel json') with the cause attached. It indicates a channel model that cannot be converted to JSON.

Solutions

  1. Inspect e.getCause() for the Jackson serialization error and fix the offending model field.
  2. Make the custom ChannelModel subclass Jackson-friendly (plain getters, no cycles) or annotate it properly.
  3. Verify the configured ObjectMapper is valid and initialized correctly.

Example fix

// before
String json = converter.convertToJson(customChannelModel); // throws on cyclic field
// after
@JsonIgnore
private SomeCycleParent parent; // fix the model, then serialize
String json = converter.convertToJson(customChannelModel);
Defensive patterns

Strategy: try-catch

Validate before calling

if (channelModel == null || channelModel.getKey() == null) {
    throw new IllegalArgumentException("ChannelModel and its key must be set before serializing");
}

Type guard

boolean isSerializable(ChannelModel m) {
    return m != null && m.getKey() != null && !m.getKey().isEmpty();
}

Try / catch

try {
    String json = converter.convertToJson(channelModel);
} catch (FlowableEventJsonException e) {
    LOG.error("Failed to serialize channel model: {}", e.getCause() != null ? e.getCause().getMessage() : e.getMessage());
    throw e;
}

Prevention

When it happens

Trigger: Calling convertToJson with a ChannelModel containing unserializable state, or the ObjectMapper supplier throwing (e.g. invalid serialization configuration, self-referencing or custom model class Jackson cannot handle).

Common situations: Using a custom ChannelModel subclass not designed for Jackson serialization, cyclic references in a custom model, or a broken ObjectMapper supplied via objectMapperSupplier.

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


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

Appendix: source

Thrown at modules/flowable-event-registry-json-converter/src/main/java/org/flowable/eventregistry/json/converter/ChannelJsonConverter.java:125

        Class<? extends ChannelModel> channelClass = channelModelClasses.get(channelType + "-" + type);
        if (channelClass != null) {
            return channelClass;
        }

        throw new FlowableEventJsonException("Not supported " + channelType + " channel model type was found " + type);
    }

    protected void validateChannel(ChannelModel channelModel) {
        for (ChannelValidator validator : validators) {
            validator.validateChannel(channelModel);
        }
    }

    public String convertToJson(ChannelModel definition) {
        try {
            return objectMapperSupplier.get().writeValueAsString(definition);
        } catch (Exception e) {
            throw new FlowableEventJsonException("Error writing channel json", e);
        }
    }

    public List<ChannelValidator> getValidators() {
        return validators;
    }

    public void addValidator(ChannelValidator validator) {
        validators.add(validator);
    }

    public void setValidators(List<ChannelValidator> validators) {
        this.validators = validators;
    }

    public Map<String, Class<? extends ChannelModel>> getChannelModelClasses() {
        return channelModelClasses;
    }

View on GitHub (pinned to d6d39ce1c6)