flowable/flowable-engine · error · FlowableException

App resource is not of type AppModel

Error message

App resource is not of type AppModel

What it means

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.

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/deploy/DeploymentManager.java:174

                deploy(deployment, null);

            } else {
                throw new FlowableException("No .app resource found for deployment '" + deploymentId + "'");
            }

            appResourceObject = appResourceCache.get(deploymentId);
            if (appResourceObject == null) {
                throw new FlowableException("deployment '" + deploymentId + "' didn't put an app resource in the cache");
            }
        }

        return appResourceObject;
    }

    public AppModel getAppResourceModel(String deploymentId) {
        Object appResourceObject = getAppResourceObject(deploymentId);
        if (!(appResourceObject instanceof AppModel)) {
            throw new FlowableException("App resource is not of type AppModel");
        }

        return (AppModel) appResourceObject;
    }

    public void removeDeployment(String deploymentId, boolean cascade) {

        DeploymentEntity deployment = deploymentEntityManager.findById(deploymentId);
        if (deployment == null) {
            throw new FlowableObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", DeploymentEntity.class);
        }

        if (Flowable5Util.isFlowable5Deployment(deployment, processEngineConfiguration)) {
            processEngineConfiguration.getFlowable5CompatibilityHandler().deleteDeployment(deploymentId, cascade);
            return;
        }

        for (EngineDeployer deployer : deployers) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Ensure only one Flowable engine version is on the classpath
  2. Use getAppResourceObject and inspect the actual runtime type to diagnose what was cached
  3. Redeploy the app resource with the current engine so a proper AppModel is cached
  4. If using Flowable 5 compatibility, route app-model access through the Flowable5CompatibilityHandler instead

Example fix

// before
AppModel model = repositoryService.getAppResourceModel(deploymentId);
// after
Object obj = repositoryService.getAppResourceObject(deploymentId);
if (obj instanceof AppModel) {
    AppModel model = (AppModel) obj;
} else {
    throw new IllegalStateException("Unexpected app resource type: " + obj.getClass());
}
Defensive patterns

Strategy: type-guard

Validate before calling

Object obj = repositoryService.getAppResourceObject(deploymentId);
boolean isAppModel = obj instanceof AppModel;

Type guard

AppModel asAppModel(Object o) {
    return (o instanceof AppModel) ? (AppModel) o : null;
}

Try / catch

try {
    AppModel model = repositoryService.getAppResourceModel(deploymentId);
} catch (FlowableException e) {
    // inspect getAppResourceObject(...) type; redeploy with matching engine version
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/5f5fc1f425bc3dc4. Report an issue: GitHub.