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
After validating the parameters, getDeploymentResourceData runs a deployment query with deploymentId(deploymentId).singleResult(). If no deployment exists with that id, it throws FlowableObjectNotFoundException for CmmnDeployment.class — identical behavior to BaseDeploymentResource.getCmmnDeployment — resulting in HTTP 404.
Solutions
- Confirm the deployment exists: GET /cmmn-repository/deployments/{deploymentId} first.
- Fetch the current deployment id list and retry with a valid id.
- Re-deploy the CMMN package if the deployment was intentionally removed.
Example fix
// before
fetchResource('dead-id', 'order.cmmn.xml'); // 404
// after
const deps = await get('/cmmn-repository/deployments');
if (deps.data.some(d => d.id === deploymentId)) await fetchResource(deploymentId, 'order.cmmn.xml'); Defensive patterns
Strategy: validation
Validate before calling
async function deploymentExists(deploymentId) {
try { await get(`/cmmn-repository/deployments/${deploymentId}`); return true; }
catch (e) { return e.response?.status !== 404; }
} Try / catch
try {
return await fetchResourceData(deploymentId, name);
} catch (e) {
if (e.response?.status === 404 && /deployment/.test(e.response.data?.message ?? '')) {
throw new Error(`Deployment ${deploymentId} missing — redeploy or refresh id`);
}
throw e;
} Prevention
- Check deployment existence before fetching its resources.
- Handle cascade-deleted deployments by re-listing deployments.
- Keep per-environment deployment registries instead of shared ids.
When it happens
Trigger: GET /cmmn-repository/deployments/{deploymentId}/res/{resourceName} where the resourceName may be valid but the deploymentId does not match any deployed deployment.
Common situations: Deployment deleted via cascade delete before fetching its resources; ids copied from a different environment; typo or truncated id in the URL.
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
- Could not find a deployment with id
- Could not find a deployment with id
- Could not find a deployment with id
- Could not find a resource with name
- ${aonfe.getMessage()}
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/0aaafa22b7d5765b.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/repository/BaseDeploymentResourceDataResource.java:57
@Autowired
protected CmmnRepositoryService repositoryService;
@Autowired(required=false)
protected CmmnRestApiInterceptor restApiInterceptor;
protected byte[] getDeploymentResourceData(String deploymentId, String resourceName, HttpServletResponse response) {
if (deploymentId == null) {
throw new FlowableIllegalArgumentException("No deployment id provided");
}
if (resourceName == null) {
throw new FlowableIllegalArgumentException("No resource name provided");
}
// Check if deployment exists
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);
}
List<String> resourceList = repositoryService.getDeploymentResourceNames(deploymentId);
if (resourceList.contains(resourceName)) {
String contentType = contentTypeResolver.resolveContentType(resourceName);
response.setContentType(contentType);
try (final InputStream resourceStream = repositoryService.getResourceAsStream(deploymentId, resourceName)) {
return IOUtils.toByteArray(resourceStream);
} catch (Exception e) {
throw new FlowableException("Error converting resource stream", e);
}View on GitHub (pinned to d6d39ce1c6)