flowable/flowable-engine · error · FlowableException

An error occurs converting output value as JSon

Error message

An error occurs converting output value as JSon

What it means

TransformationDataOutputAssociation.evaluate converts the source expression value to a Jackson JsonNode when the target variable is JSON, using ObjectMapper.convertValue. If Jackson cannot convert the value (e.g. an incompatible bean/structure), it throws IllegalArgumentException, which Flowable wraps in this FlowableException. The target variable is then never set.

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/data/TransformationDataOutputAssociation.java:63

    public void evaluate(DelegateExecution execution) {
        Object value = this.transformation.getValue(execution);

        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration();
        VariableTypes variableTypes = processEngineConfiguration.getVariableServiceConfiguration().getVariableTypes();
        try {
            variableTypes.findVariableType(value);
        } catch (final FlowableException e) {
            // Couldn't find a variable type that is able to serialize the output value
            // Perhaps the output value is a Java bean, we try to convert it as JSon
            try {
                final ObjectMapper mapper = JsonMapper.builder()
                        // By default, Jackson serializes only public fields, we force to use all fields of the Java Bean
                        .changeDefaultVisibility(visibilityChecker -> visibilityChecker.withFieldVisibility(Visibility.ANY))
                        .build();

                value = mapper.convertValue(value, JsonNode.class);
            } catch (final IllegalArgumentException e1) {
                throw new FlowableException("An error occurs converting output value as JSon", e1);
            }
        }

        execution.setVariable(this.getTarget(), value);
    }
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Inspect the wrapped IllegalArgumentException cause to see which property/conversion failed and fix the source object (add getters, remove cycles, use @JsonIgnore)
  2. Make the expression return a Jackson-friendly type (Map, List, primitives, JsonNode) instead of an exotic bean
  3. Register a custom serializer/module on the ObjectMapper path or pre-convert the value yourself in the expression
  4. Ensure the bean has a no-arg constructor and public accessors so convertValue can map it

Example fix

// before: expression returns a bean Jackson cannot map (cyclic reference)
expression.setValue(userEntity);

// after: return a simple DTO
UserDto dto = UserDto.from(userEntity);
expression.setValue(dto);
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check: ensure the value is Jackson-convertible
new ObjectMapper().convertValue(value, JsonNode.class); // throws IllegalArgumentException early if not

Try / catch

try {
    repositoryService.createDeployment().addClasspathResource(process).deploy();
} catch (FlowableException e) {
    if (e.getMessage().contains("converting output value as JSon")) {
        // fix the transformation source object; log cause
        logger.warn("JSON transformation failed: {}", e.getCause());
    }
}

Prevention

When it happens

Trigger: A dataOutputAssociation with a transformation whose evaluated output cannot be converted to JsonNode by Jackson — e.g. the expression returns an object Jackson cannot serialize (no accessible properties, recursive structure, incompatible types) while the code path forces JsonNode conversion.

Common situations: Transformation expressions returning custom beans with fields Jackson refuses to handle; cyclic object graphs; value types that map ambiguously to JSON (e.g. raw Map with non-String keys); upgrades changing Jackson visibility handling.

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/a4d21920e8aa23eb. Report an issue: GitHub.