{"record":{"id":"796e9e10e415c22f","repo":"flowable/flowable-engine","slug":"error-reading-app-resource","errorCode":null,"errorMessage":"Error reading app resource","messagePattern":"Error reading app resource","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":34,"sourceCode":"import org.flowable.app.api.repository.AppResourceConverter;\nimport org.flowable.common.engine.api.FlowableException;\n\nimport tools.jackson.databind.ObjectMapper;\n\npublic class AppResourceConverterImpl implements AppResourceConverter {\n\n    protected ObjectMapper objectMapper;\n\n    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":16,"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#L16-L47","documentation":"FlowableException (wrapping the Jackson cause) thrown by AppResourceConverterImpl.convertAppResourceToModel when the app resource bytes cannot be deserialized into a BaseAppModel. The app resource is expected to be valid JSON matching the app model schema.","triggerScenarios":"Passing a byte[] to convertAppResourceToModel that is not valid JSON — e.g. binary .app/zip content, an empty array, truncated file, or JSON missing required model fields.","commonSituations":"Deploying a .zip renamed to .app instead of a JSON app resource; file saved with wrong encoding or corrupted in transit; hand-edited app JSON with syntax errors; passing an app archive's binary entry instead of the app.json resource.","solutions":["Ensure the bytes are the JSON app resource (valid UTF-8 JSON with model name/fields), not a zip archive","Validate the JSON with a linter or by parsing it before conversion","Check for truncation/encoding issues in how the resource was read (read bytes fully, correct charset)","If cause is missing fields, align the JSON with BaseAppModel structure"],"exampleFix":"// before\nbyte[] bytes = Files.readAllBytes(Path.of(\"my-app.zip\")); // binary zip\nAppModel m = converter.convertAppResourceToModel(bytes);\n// after\nbyte[] bytes = extractAppJsonFromZip(Path.of(\"my-app.zip\")); // get inner app JSON\nAppModel m = converter.convertAppResourceToModel(bytes);","handlingStrategy":"validation","validationCode":"String s = new String(bytes, StandardCharsets.UTF_8).trim();\nif (s.isEmpty() || (!s.startsWith(\"{\") && !s.startsWith(\"[\"))) {\n    throw new IllegalArgumentException(\"App resource must be JSON, not binary/zip content\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    AppModel model = converter.convertAppResourceToModel(bytes);\n} catch (FlowableException e) {\n    logger.error(\"Invalid app resource JSON\", e.getCause());\n    throw new IllegalArgumentException(\"Malformed app resource\", e);\n}","preventionTips":["Only pass the JSON app resource, never the .zip/.app archive bytes","Validate JSON syntax before deployment","Read resources fully with correct charset to avoid truncation"],"tags":["flowable","json","deserialization","app-resource"],"backgroundTag":"json-parse-error","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"}