flowable/flowable-engine · error · FlowableException

Error writing execution json

Error message

Error writing execution json

What it means

While persisting history, the command serializes executeDecisionContext.getDecisionExecution() to JSON via the configured ObjectMapper and stores it as executionJson. If serialization fails for any reason it wraps the exception in FlowableException with message 'Error writing execution json'.

Solutions

  1. Inspect the wrapped cause 'e' in the exception to see the actual serialization failure
  2. Configure the DMN engine's ObjectMapper (dmnEngineConfiguration.setObjectMapper) to tolerate the data (e.g. FAIL_ON_EMPTY_BEANS disabled)
  3. Remove or fix unserializable values in the decision execution / rule variables

Example fix

// before
ObjectMapper mapper = new ObjectMapper(); // strict defaults
// after
ObjectMapper mapper = new ObjectMapper()
    .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
dmnEngineConfiguration.setObjectMapper(mapper);
Defensive patterns

Strategy: try-catch

Validate before calling

if (executionJsonSource != null && executionJsonSource.toString().length() > 1_000_000) {
    log.warn("Decision execution payload unusually large");
}

Try / catch

try {
    dmnEngine.executeDecide(decisionKey, vars);
} catch (FlowableException e) {
    if ("Error writing execution json".equals(e.getMessage()) && e.getCause() != null) {
        log.error("JSON serialization of decision execution failed", e.getCause());
        throw new IllegalStateException("Unserializable decision data", e.getCause());
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling DmnEngine.executeDecide / ExecuteDecisionActivityBehavior with history enabled, where the DecisionExecution object graph contains values the ObjectMapper cannot serialize (unserializable types, circular references, broken custom serializers).

Common situations: Custom DecisionExecution subclasses with getters throwing exceptions, ObjectMapper misconfiguration (e.g. failing on empty beans), or invalid runtime data (dates/objects) placed into decision variables.

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

Appendix: source

Thrown at modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/PersistHistoricDecisionExecutionCmd.java:75

            decisionExecutionEntity.setExecutionId(executeDecisionContext.getExecutionId());
            decisionExecutionEntity.setActivityId(executeDecisionContext.getActivityId());
            decisionExecutionEntity.setScopeType(executeDecisionContext.getScopeType());
            decisionExecutionEntity.setTenantId(executeDecisionContext.getTenantId());

            Boolean failed = executeDecisionContext.getDecisionExecution().isFailed();
            if (BooleanUtils.isTrue(failed)) {
                decisionExecutionEntity.setFailed(failed.booleanValue());
            }

            ObjectMapper objectMapper = engineConfiguration.getObjectMapper();
            if (objectMapper == null) {
                objectMapper = JsonMapper.shared();
            }

            try {
                decisionExecutionEntity.setExecutionJson(objectMapper.writeValueAsString(executeDecisionContext.getDecisionExecution()));
            } catch (Exception e) {
                throw new FlowableException("Error writing execution json", e);
            }

            historicDecisionExecutionEntityManager.insert(decisionExecutionEntity);
        }

        return null;
    }
}

View on GitHub (pinned to d6d39ce1c6)