flowable/flowable-engine · error · FlowableObjectNotFoundException

No deployment found for id = '${deploymentId}'

Error message

No deployment found for id = '${deploymentId}'

What it means

SetDeploymentKeyCmd.execute throws FlowableObjectNotFoundException when findById(deploymentId) returns no deployment. The message embeds the requested id and the type Deployment.class. Analogous to the category variant (error 2425) but for setting the deployment key.

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/SetDeploymentKeyCmd.java:53

    protected String key;

    public SetDeploymentKeyCmd(String deploymentId, String key) {
        this.deploymentId = deploymentId;
        this.key = key;
    }

    @Override
    public Void execute(CommandContext commandContext) {

        if (deploymentId == null) {
            throw new FlowableIllegalArgumentException("Deployment id is null");
        }

        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
        DeploymentEntity deployment = processEngineConfiguration.getDeploymentEntityManager().findById(deploymentId);

        if (deployment == null) {
            throw new FlowableObjectNotFoundException("No deployment found for id = '" + deploymentId + "'", Deployment.class);
        }

        if (Flowable5Util.isFlowable5Deployment(deployment, commandContext)) {
            throw new FlowableException("Not supported for version 5 deployments");
        }

        // Update category
        deployment.setKey(key);

        FlowableEventDispatcher eventDispatcher = processEngineConfiguration.getEventDispatcher();
        if (eventDispatcher != null && eventDispatcher.isEnabled()) {
            eventDispatcher.dispatchEvent(FlowableEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, deployment),
                    processEngineConfiguration.getEngineCfgKey());
        }

        return null;
    }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Check existence with repositoryService.createDeploymentQuery().deploymentId(id).count() > 0 before calling.
  2. Re-fetch the current deployment id after any redeploy or cleanup.
  3. Verify the flowable database configuration matches the environment the deployment was made in.

Example fix

// before
repositoryService.setDeploymentKey(deletedId, "key");
// after
Deployment d = repositoryService.createDeploymentQuery().deploymentId(deletedId).singleResult();
if (d != null) {
    repositoryService.setDeploymentKey(deletedId, "key");
}
Defensive patterns

Strategy: try-catch

Validate before calling

Deployment d = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
if (d == null) {
    throw new IllegalStateException("No deployment with id " + deploymentId);
}
repositoryService.setDeploymentKey(deploymentId, key);

Try / catch

try {
    repositoryService.setDeploymentKey(deploymentId, key);
} catch (FlowableObjectNotFoundException e) {
    // deployment removed or wrong database; re-derive id from a fresh query
    log.warn("Deployment missing: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling repositoryService.setDeploymentKey(deploymentId, key) with an id for a deployment that does not exist in the engine's database.

Common situations: Id from a deleted/cleaned-up deployment; pointing the engine at a different database; typo or stale reference in configuration or code.

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/10d1101b97164d01. Report an issue: GitHub.