flowable/flowable-engine · error · FlowableObjectNotFoundException

Could not find a deployment with id '${deploymentId}'.

Error message

Could not find a deployment with id '${deploymentId}'.

What it means

FlowableObjectNotFoundException thrown by BaseDeploymentResource.getEventDeployment when a deployment query by id returns no result. The REST API uses this to signal that the referenced event registry deployment does not exist, typically mapped to HTTP 404.

Source

Thrown at modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/BaseDeploymentResource.java:37

import org.flowable.eventregistry.rest.service.api.EventRegistryRestApiInterceptor;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author Tijs Rademakers
 */
public class BaseDeploymentResource {

    @Autowired
    protected EventRepositoryService repositoryService;
    
    @Autowired(required=false)
    protected EventRegistryRestApiInterceptor restApiInterceptor;

    protected EventDeployment getEventDeployment(String deploymentId) {
        EventDeployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();

        if (deployment == null) {
            throw new FlowableObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", EventDeployment.class);
        }
        
        if (restApiInterceptor != null) {
            restApiInterceptor.accessDeploymentById(deployment);
        }
        
        return deployment;
    }
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Verify the deploymentId by listing deployments via GET /event-registry-deployments and using a returned id
  2. Check the app is connected to the same database/schema where the deployment was created
  3. Re-deploy the event definition if the deployment was removed
  4. If programmatically querying, use createDeploymentQuery().latest() or list results to confirm what exists

Example fix

// before
GET /event-registry-repository/deployments/abc-123   // never deployed
// after
deployments = repositoryService.createDeploymentQuery().list();
GET /event-registry-repository/deployments/" + deployments.get(0).getId()
Defensive patterns

Strategy: try-catch

Validate before calling

long count = repositoryService.createDeploymentQuery().deploymentId(deploymentId).count();
if (count == 0) { /* handle missing deployment before calling the REST API */ }

Type guard

boolean deploymentExists = id -> repositoryService.createDeploymentQuery().deploymentId(id).count() > 0;

Try / catch

try {
    EventDeploymentResource d = restClient.getDeployment(deploymentId);
} catch (FlowableObjectNotFoundException e) {
    logger.warn("Deployment {} not found; redeploying", deploymentId);
    redeploy();
}

Prevention

When it happens

Trigger: A REST call such as GET /event-registry-deployments/{deploymentId} references a deploymentId that does not match any deployment in the ACT_DE_DATABASECHANGELOG/deployment tables, so repositoryService.createDeploymentQuery().deploymentId(id).singleResult() returns null.

Common situations: Client using a stale or wrong id after the deployment was deleted; querying a different database/tenant than where the deployment was made; truncating or swapping the database between deploy and query; confusing deployment ids with event definition keys.

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/5bce41383b3dc7e1. Report an issue: GitHub.