{"record":{"id":"5f5fc1f425bc3dc4","repo":"flowable/flowable-engine","slug":"app-resource-is-not-of-type-appmodel","errorCode":null,"errorMessage":"App resource is not of type AppModel","messagePattern":"App resource is not of type AppModel","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/deploy/DeploymentManager.java","lineNumber":174,"sourceCode":"                deploy(deployment, null);\n\n            } else {\n                throw new FlowableException(\"No .app resource found for deployment '\" + deploymentId + \"'\");\n            }\n\n            appResourceObject = appResourceCache.get(deploymentId);\n            if (appResourceObject == null) {\n                throw new FlowableException(\"deployment '\" + deploymentId + \"' didn't put an app resource in the cache\");\n            }\n        }\n\n        return appResourceObject;\n    }\n\n    public AppModel getAppResourceModel(String deploymentId) {\n        Object appResourceObject = getAppResourceObject(deploymentId);\n        if (!(appResourceObject instanceof AppModel)) {\n            throw new FlowableException(\"App resource is not of type AppModel\");\n        }\n\n        return (AppModel) appResourceObject;\n    }\n\n    public void removeDeployment(String deploymentId, boolean cascade) {\n\n        DeploymentEntity deployment = deploymentEntityManager.findById(deploymentId);\n        if (deployment == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a deployment with id '\" + deploymentId + \"'.\", DeploymentEntity.class);\n        }\n\n        if (Flowable5Util.isFlowable5Deployment(deployment, processEngineConfiguration)) {\n            processEngineConfiguration.getFlowable5CompatibilityHandler().deleteDeployment(deploymentId, cascade);\n            return;\n        }\n\n        for (EngineDeployer deployer : deployers) {","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/deploy/DeploymentManager.java#L156-L192","documentation":"Flowable throws FlowableException when the cached app resource object for a deployment is not an instance of AppModel, so getAppResourceModel cannot cast it. The app cache stored some object, but of an unexpected type — typically a resource registered by a different subsystem or an older format.","triggerScenarios":"getAppResourceModel(deploymentId) where the deployment's cached app resource is a raw object rather than a parsed AppModel (mixed engine versions, custom deployers, or Flowable 5 compatibility resources).","commonSituations":"Mixing Flowable 5 and 6 deployments in a compatibility setup; custom deployment processors that put non-AppModel objects into the app resource cache; classpath conflicts shipping two Flowable versions.","solutions":["Ensure only one Flowable engine version is on the classpath","Use getAppResourceObject and inspect the actual runtime type to diagnose what was cached","Redeploy the app resource with the current engine so a proper AppModel is cached","If using Flowable 5 compatibility, route app-model access through the Flowable5CompatibilityHandler instead"],"exampleFix":"// before\nAppModel model = repositoryService.getAppResourceModel(deploymentId);\n// after\nObject obj = repositoryService.getAppResourceObject(deploymentId);\nif (obj instanceof AppModel) {\n    AppModel model = (AppModel) obj;\n} else {\n    throw new IllegalStateException(\"Unexpected app resource type: \" + obj.getClass());\n}","handlingStrategy":"type-guard","validationCode":"Object obj = repositoryService.getAppResourceObject(deploymentId);\nboolean isAppModel = obj instanceof AppModel;","typeGuard":"AppModel asAppModel(Object o) {\n    return (o instanceof AppModel) ? (AppModel) o : null;\n}","tryCatchPattern":"try {\n    AppModel model = repositoryService.getAppResourceModel(deploymentId);\n} catch (FlowableException e) {\n    // inspect getAppResourceObject(...) type; redeploy with matching engine version\n}","preventionTips":["Keep a single Flowable version on the classpath","Route Flowable 5 resources through the compatibility handler","Redeploy app resources with the current engine"],"tags":["flowable","app-deployment","type-mismatch","cache"],"backgroundTag":"type-mismatch","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}