flowable/flowable-engine · error · FlowableObjectNotFoundException

Could not find a deployment with id

Error message

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

What it means

BaseDeploymentResource.getCmmnDeployment queries for a CMMN deployment by id (repositoryService.createDeploymentQuery().deploymentId(id).singleResult()). If no deployment matches, it throws FlowableObjectNotFoundException for CmmnDeployment.class, which maps to HTTP 404. If found, the optional restApiInterceptor may still veto access.

Solutions

  1. List deployments via GET /cmmn-repository/deployments and use an existing id.
  2. Re-deploy the CMMN model if the deployment was deleted in this environment.
  3. Confirm the environment/database the REST API points to matches where the deployment was made.

Example fix

// before
GET /cmmn-repository/deployments/deploy-123   // deleted
// after
GET /cmmn-repository/deployments              // discover current id
GET /cmmn-repository/deployments/9f01a3c4-...
Defensive patterns

Strategy: try-catch

Validate before calling

const deps = await get('/cmmn-repository/deployments');
if (!deps.data.some(d => d.id === deploymentId)) throw new Error(`Unknown deployment: ${deploymentId}`);

Try / catch

try {
  return await getDeployment(id);
} catch (e) {
  if (e.response?.status === 404) {
    const list = await get('/cmmn-repository/deployments');
    throw new Error(`Deployment ${id} not found. Available: ${list.data.map(d => d.id)}`);
  }
  throw e;
}

Prevention

When it happens

Trigger: REST calls that take a deploymentId path variable (e.g. GET /cmmn-repository/deployments/{deploymentId}, its resources sub-endpoints) when the id does not correspond to an existing deployment.

Common situations: Using a stale id after the deployment was deleted (POST /cmmn-repository/deployments/{id} with cascade deletes it); hard-coded ids from another environment; confusing a deployment id with a deployment resource id or definition id.

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/303ad2e10d2b7c54. Report an issue: GitHub.

Appendix: source

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

import org.flowable.common.engine.api.FlowableObjectNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;

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

    @Autowired
    protected CmmnRepositoryService repositoryService;
    
    @Autowired(required=false)
    protected CmmnRestApiInterceptor restApiInterceptor;

    protected CmmnDeployment getCmmnDeployment(String deploymentId) {
        CmmnDeployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();

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

View on GitHub (pinned to d6d39ce1c6)