{"record":{"id":"919179041ba44ded","repo":"flowable/flowable-engine","slug":"error-writing-execution-json","errorCode":null,"errorMessage":"Error writing execution json","messagePattern":"Error writing execution json","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/PersistHistoricDecisionExecutionCmd.java","lineNumber":75,"sourceCode":"            decisionExecutionEntity.setExecutionId(executeDecisionContext.getExecutionId());\r\n            decisionExecutionEntity.setActivityId(executeDecisionContext.getActivityId());\r\n            decisionExecutionEntity.setScopeType(executeDecisionContext.getScopeType());\r\n            decisionExecutionEntity.setTenantId(executeDecisionContext.getTenantId());\r\n\r\n            Boolean failed = executeDecisionContext.getDecisionExecution().isFailed();\r\n            if (BooleanUtils.isTrue(failed)) {\r\n                decisionExecutionEntity.setFailed(failed.booleanValue());\r\n            }\r\n\r\n            ObjectMapper objectMapper = engineConfiguration.getObjectMapper();\r\n            if (objectMapper == null) {\r\n                objectMapper = JsonMapper.shared();\r\n            }\r\n\r\n            try {\r\n                decisionExecutionEntity.setExecutionJson(objectMapper.writeValueAsString(executeDecisionContext.getDecisionExecution()));\r\n            } catch (Exception e) {\r\n                throw new FlowableException(\"Error writing execution json\", e);\r\n            }\r\n\r\n            historicDecisionExecutionEntityManager.insert(decisionExecutionEntity);\r\n        }\r\n\r\n        return null;\r\n    }\r\n}\r\n","sourceCodeStart":57,"sourceCodeEnd":84,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/PersistHistoricDecisionExecutionCmd.java#L57-L84","documentation":"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'.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Inspect the wrapped cause 'e' in the exception to see the actual serialization failure","Configure the DMN engine's ObjectMapper (dmnEngineConfiguration.setObjectMapper) to tolerate the data (e.g. FAIL_ON_EMPTY_BEANS disabled)","Remove or fix unserializable values in the decision execution / rule variables"],"exampleFix":"// before\nObjectMapper mapper = new ObjectMapper(); // strict defaults\n// after\nObjectMapper mapper = new ObjectMapper()\n    .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);\ndmnEngineConfiguration.setObjectMapper(mapper);","handlingStrategy":"try-catch","validationCode":"if (executionJsonSource != null && executionJsonSource.toString().length() > 1_000_000) {\n    log.warn(\"Decision execution payload unusually large\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    dmnEngine.executeDecide(decisionKey, vars);\n} catch (FlowableException e) {\n    if (\"Error writing execution json\".equals(e.getMessage()) && e.getCause() != null) {\n        log.error(\"JSON serialization of decision execution failed\", e.getCause());\n        throw new IllegalStateException(\"Unserializable decision data\", e.getCause());\n    }\n    throw e;\n}","preventionTips":["Inspect e.getCause() to find the real serialization problem","Configure a tolerant ObjectMapper on DmnEngineConfiguration","Keep rule variables and custom entities JSON-serializable (no circular refs)"],"tags":["java","flowable-dmn","json","serialization"],"backgroundTag":"json-marshal-failed","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}