{"record":{"id":"5e7ff9108af36bf4","repo":"flowable/flowable-engine","slug":"error-writing-app-model-to-json","errorCode":null,"errorMessage":"Error writing app model  to json","messagePattern":"Error writing app model  to json","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/deployer/AppResourceConverterImpl.java","lineNumber":43,"sourceCode":"    public AppResourceConverterImpl(ObjectMapper objectMapper) {\n        this.objectMapper = objectMapper;\n    }\n\n    @Override\n    public AppModel convertAppResourceToModel(byte[] appResourceBytes) {\n        try {\n            return objectMapper.readValue(appResourceBytes, BaseAppModel.class);\n        } catch (Exception e) {\n            throw new FlowableException(\"Error reading app resource\", e);\n        }\n    }\n\n    @Override\n    public String convertAppModelToJson(AppModel appModel) {\n        try {\n            return objectMapper.writeValueAsString(appModel);\n        } catch (Exception e) {\n            throw new FlowableException(\"Error writing app model \" + appModel.getKey() + \" to json\", e);\n        }\n    }\n}\n","sourceCodeStart":25,"sourceCodeEnd":47,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/deployer/AppResourceConverterImpl.java#L25-L47","documentation":"FlowableException (wrapping the Jackson cause) thrown by AppResourceConverterImpl.convertAppModelToJson when the given AppModel cannot be serialized to a JSON string. The message includes the model's key (possibly blank) to identify which model failed.","triggerScenarios":"Calling convertAppModelToJson with a model whose structure Jackson cannot write — e.g. custom AppModel implementation exposing unserializable types, self-referencing structures, or invalid property values.","commonSituations":"Extending BaseAppModel with a field of a non-serializable type and not disabling FAIL_ON_EMPTY_BEANS or adding serializers; cyclic references in model metadata; passing a null/garbage model built programmatically.","solutions":["Check the wrapped cause for the exact Jackson failure","Fix or annotate the offending field in the model (add @JsonIgnore, Serializable types, or a custom serializer)","Ensure you construct/obtain the AppModel via the app engine API rather than hand-building it","If using a custom subclass, verify all getters return Jackson-serializable values"],"exampleFix":"// before\nclass MyAppModel extends BaseAppModel { private transient Object weirdField; /* getter exposed */ }\n// after\nclass MyAppModel extends BaseAppModel {\n    @JsonIgnore\n    public Object getWeirdField() { return weirdField; }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    String json = converter.convertAppModelToJson(model);\n} catch (FlowableException e) {\n    logger.error(\"Failed to serialize app model '\" + model.getKey() + \"'\", e.getCause());\n    throw e;\n}","preventionTips":["Annotate non-serializable fields with @JsonIgnore","Avoid cyclic references in custom model classes","Test serialization of custom AppModel subclasses in unit tests"],"tags":["flowable","json","serialization","app-model"],"backgroundTag":"json-serialization-failed","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}