{"record":{"id":"fc01acfe7d5cd805","repo":"flowable/flowable-engine","slug":"error-reading-app-resource-fc01ac","errorCode":null,"errorMessage":"Error reading app resource","messagePattern":"Error reading app resource","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/app/AppResourceConverterImpl.java","lineNumber":35,"sourceCode":"import org.flowable.engine.app.AppResourceConverter;\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        AppModel appModel;\n        try {\n            appModel = objectMapper.readValue(appResourceBytes, AppModel.class);\n        } catch (Exception e) {\n            throw new FlowableException(\"Error reading app resource\", e);\n        }\n\n        return appModel;\n    }\n\n}\n","sourceCodeStart":17,"sourceCodeEnd":42,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/app/AppResourceConverterImpl.java#L17-L42","documentation":"AppResourceConverterImpl deserializes an .app resource (JSON) into an AppModel via Jackson. Any exception from objectMapper.readValue is wrapped and rethrown as FlowableException(\"Error reading app resource\"). It indicates the app resource bytes are not valid JSON or do not match the AppModel schema.","triggerScenarios":"Calling RepositoryService.deploy(...) with a corrupted/truncated .app file, or AppResourceConverterImpl.convertAppResourceToModel(byte[]) with bytes that are not valid JSON or whose fields mismatch AppModel.","commonSituations":"Uploading an app export that was hand-edited and became invalid JSON; uploading a wrong file type (e.g. a BPMN XML or zip instead of the app JSON); character-encoding corruption during download; schema drift between Flowable versions (AppModel fields renamed).","solutions":["Validate the .app resource is well-formed JSON (e.g. with a JSON parser) before deploying; inspect the wrapped cause 'e' for the exact parse error and offset.","Re-export the app model from Flowable Modeler/UI instead of hand-editing the JSON.","Check that the file is the app resource (JSON) and not a BPMN XML or other artifact.","If caused by a version upgrade, regenerate/upgrade the app resource to match the current AppModel schema."],"exampleFix":"// before\nbyte[] bytes = Files.readAllBytes(path); // possibly wrong file\nrepositoryService.createDeployment().addBytes(\"my.app\", bytes).deploy();\n// after\nString json = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);\nnew ObjectMapper().readTree(json); // sanity check: throws if not valid JSON\nrepositoryService.createDeployment().addBytes(\"my.app\", json.getBytes(StandardCharsets.UTF_8)).deploy();","handlingStrategy":"validation","validationCode":"try {\n    new ObjectMapper().readTree(new String(appResourceBytes, StandardCharsets.UTF_8));\n} catch (IOException e) {\n    throw new IllegalArgumentException(\"App resource is not valid JSON\", e);\n}\n// then convert\nappResourceConverter.convertAppResourceToModel(appResourceBytes);","typeGuard":null,"tryCatchPattern":"try {\n    AppModel model = converter.convertAppResourceToModel(bytes);\n} catch (FlowableException e) {\n    log.error(\"Invalid app resource JSON\", e.getCause()); // inspect cause for parser details\n}","preventionTips":["Validate .app files are well-formed JSON before deployment","Never hand-edit exported app JSON without re-validating","Deploy the correct artifact type (app JSON, not BPMN XML/zip)","Re-export app resources after Flowable version upgrades to match the AppModel schema"],"tags":["json","deserialization","app-resource"],"backgroundTag":"json-decode-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"}