flowable/flowable-engine · error · FlowableObjectNotFoundException
deployment does not exist: <deploymentId>
Error message
deployment does not exist: <deploymentId>
What it means
When findResourceByDeploymentIdAndResourceName returns no resource, GetDeploymentResourceCmd distinguishes two causes. If the deployment id itself does not exist in the deployment entity manager, it throws FlowableObjectNotFoundException "deployment does not exist: <id>". So the deployment id is a valid format but refers to no persisted deployment.
Source
Thrown at modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/GetDeploymentResourceCmd.java:52
public GetDeploymentResourceCmd(String deploymentId, String resourceName) {
this.deploymentId = deploymentId;
this.resourceName = resourceName;
}
@Override
public InputStream execute(CommandContext commandContext) {
if (deploymentId == null) {
throw new FlowableIllegalArgumentException("deploymentId is null");
}
if (resourceName == null) {
throw new FlowableIllegalArgumentException("resourceName is null");
}
DmnResourceEntity resource = CommandContextUtil.getResourceEntityManager().findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);
if (resource == null) {
if (CommandContextUtil.getDeploymentEntityManager(commandContext).findById(deploymentId) == null) {
throw new FlowableObjectNotFoundException("deployment does not exist: " + deploymentId);
} else {
throw new FlowableObjectNotFoundException("no resource found with name '" + resourceName + "' in deployment '" + deploymentId + "'");
}
}
return new ByteArrayInputStream(resource.getBytes());
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Resolve the current deployment id at runtime via createDeploymentQuery() instead of hard-coding/stale ids
- Confirm you are using dmnRepositoryService (DMN deployments), not the process engine's repository service
- Catch FlowableObjectNotFoundException and either redeploy the resource or return a 404-style response to the caller
Example fix
// before
repoService.getDeploymentResource("771", "rules.dmn"); // stale id
// after
Deployment d = repoService.createDeploymentQuery().deploymentName("rules").latest().singleResult();
if (d == null) throw new NotFoundException("rules deployment missing");
repoService.getDeploymentResource(d.getId(), "rules.dmn"); Defensive patterns
Strategy: try-catch
Validate before calling
DmnDeploymentEntity dep = CommandContextUtil.getDeploymentEntityManager(ctx).findById(deploymentId); // or deployment query
if (dep == null) throw new NotFoundException("deployment " + deploymentId + " not deployed"); Try / catch
try { return repoService.getDeploymentResource(depId, name); } catch (FlowableObjectNotFoundException e) { if (e.getMessage().startsWith("deployment does not exist")) { return ResponseEntity.notFound().build(); } throw e; } Prevention
- Never hard-code deployment ids; resolve the latest deployment by name/key at runtime
- Use the DMN repository service for DMN deployments, not the process engine's
- Account for deployment cleanup jobs in id lifetime assumptions
When it happens
Trigger: getDeploymentResource("12345", "file.dmn") where 12345 was never deployed or was deleted — e.g. an id from another engine's database, a stale id after redeployment, or a fabricated id in a test.
Common situations: Hard-coded deployment ids after re-provisioning the database; using a process-engine deployment id against the DMN repository service (separate tables); cleanup jobs removing old deployments while code still caches ids.
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
- resource '${resource}' not found
- Could not find a resource with id '${resourceName}' in deplo
- Required decision <decisionId> is not available
- no decision service with id: '<decisionKey>' found in defini
- deploymentId is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/9bf6180b15b8f7ac.
Report an issue: GitHub.