flowable/flowable-engine · error · FlowableObjectNotFoundException

Could not find deployment with id

Error message

Could not find deployment with id 

What it means

After validating the id, ChangeDeploymentTenantIdCmd looks up the deployment by id. If no deployment exists with that id, Flowable throws FlowableObjectNotFoundException (with Deployment.class as the missing type).

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ChangeDeploymentTenantIdCmd.java:90

    }

    public ChangeDeploymentTenantIdCmd(String deploymentId, String newTenantId, DeploymentMergeStrategy deploymentMergeStrategy) {
        this.deploymentId = deploymentId;
        this.newTenantId = newTenantId;
        this.deploymentMergeStrategy = deploymentMergeStrategy;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        if (deploymentId == null) {
            throw new FlowableIllegalArgumentException("deploymentId is null");
        }

        // Update all entities
        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
        DeploymentEntity deployment = processEngineConfiguration.getDeploymentEntityManager().findById(deploymentId);
        if (deployment == null) {
            throw new FlowableObjectNotFoundException("Could not find deployment with id " + deploymentId, Deployment.class);
        }

        if (Flowable5Util.isFlowable5Deployment(deployment, commandContext)) {
            processEngineConfiguration.getFlowable5CompatibilityHandler().changeDeploymentTenantId(deploymentId, newTenantId);
            return null;
        }

        deploymentMergeStrategy.prepareMerge(commandContext, deploymentId, newTenantId);
        String oldTenantId = deployment.getTenantId();
        deployment.setTenantId(newTenantId);

        // Doing process instances, executions and tasks with direct SQL updates
        // (otherwise would not be performant)
        processEngineConfiguration.getProcessDefinitionEntityManager().updateProcessDefinitionTenantIdForDeployment(deploymentId, newTenantId);
        processEngineConfiguration.getExecutionEntityManager().updateExecutionTenantIdForDeployment(deploymentId, newTenantId);
        processEngineConfiguration.getTaskServiceConfiguration().getTaskService().updateTaskTenantIdForDeployment(deploymentId, newTenantId);
        JobService jobService = processEngineConfiguration.getJobServiceConfiguration().getJobService();
        jobService.updateAllJobTypesTenantIdForDeployment(deploymentId, newTenantId);

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Verify the deployment id exists via repositoryService.createDeploymentQuery().deploymentId(id).singleResult().
  2. Correct the id source (config, process variable, lookup by key instead of id).
  3. Check that the engine is connected to the database/schema that holds the deployment.

Example fix

// before
repositoryService.changeDeploymentTenantId(deploymentId, tenantId);
// after
Deployment d = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (d != null) {
    repositoryService.changeDeploymentTenantId(deploymentId, tenantId);
}
Defensive patterns

Strategy: validation

Validate before calling

Deployment d = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (d == null) {
    throw new IllegalArgumentException("Deployment does not exist: " + deploymentId);
}

Try / catch

try {
    repositoryService.changeDeploymentTenantId(deploymentId, tenantId);
} catch (FlowableObjectNotFoundException e) {
    // deployment missing; log and surface to user
}

Prevention

When it happens

Trigger: Calling repositoryService.changeDeploymentTenantId(id, tenantId) with an id of a deleted, never-deployed, or typo'd deployment; using an id from a different engine/database.

Common situations: Stale cached deployment ids after redeployment or DB cleanup; hard-coded ids in tests; pointing at the wrong database schema or tenant-scoped data.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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