flowable/flowable-engine · error · ActivitiObjectNotFoundException
No process definition found for id = '" +…
Error message
No process definition found for id = '" + processDefinitionId + "'
What it means
SetProcessDefinitionCategoryCmd looks up the definition via ProcessDefinitionEntityManager.findProcessDefinitionById; when no definition matches the id it throws ActivitiObjectNotFoundException carrying the id and ProcessDefinition.class.
Solutions
- Resolve the current id via RepositoryService.createProcessDefinitionQuery().processDefinitionKey(key).latestVersion().singleResult().
- Verify the engine points at the database containing the definition.
- Re-deploy the process definition if it was removed and use the fresh id.
Example fix
// before
repositoryService.setProcessDefinitionCategory(processDefinitionId, "billing");
// after
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(processDefinitionId).singleResult();
if (pd != null) {
repositoryService.setProcessDefinitionCategory(processDefinitionId, "billing");
} Defensive patterns
Strategy: validation
Validate before calling
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(pdId).singleResult();
if (pd == null) throw new IllegalArgumentException("No process definition " + pdId); Try / catch
try { repositoryService.setProcessDefinitionCategory(pdId, category); }
catch (ActivitiObjectNotFoundException e) { log.warn("definition {} not found", pdId); } Prevention
- Look up latest version by key instead of hard-coding definition ids
- Re-resolve ids after every redeploy
- Check environment/database alignment
When it happens
Trigger: RepositoryService.setProcessDefinitionCategory(processDefinitionId, category) with an id absent from ACT_RE_PROCDEF — typo, wrong database, or the definition was redeployed with a new id/version.
Common situations: Hard-coded definition ids that changed between deployments, cross-environment id reuse, schema cleaned by deletion jobs, multi-tenant/engine mismatch.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Cannot find process definition for id
- Cannot find process definition for id
- Cannot find process definition for key
- Cannot find process definition for key
- Cannot find process definition with id
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/3d00b934e57eccb2.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/SetProcessDefinitionCategoryCmd.java:52
public SetProcessDefinitionCategoryCmd(String processDefinitionId, String category) {
this.processDefinitionId = processDefinitionId;
this.category = category;
}
@Override
public Void execute(CommandContext commandContext) {
if (processDefinitionId == null) {
throw new ActivitiIllegalArgumentException("Process definition id is null");
}
ProcessDefinitionEntity processDefinition = commandContext
.getProcessDefinitionEntityManager()
.findProcessDefinitionById(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiObjectNotFoundException("No process definition found for id = '" + processDefinitionId + "'", ProcessDefinition.class);
}
// Update category
processDefinition.setCategory(category);
// Remove process definition from cache, it will be refetched later
DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache = commandContext.getProcessEngineConfiguration().getProcessDefinitionCache();
if (processDefinitionCache != null) {
processDefinitionCache.remove(processDefinitionId);
}
if (commandContext.getEventDispatcher().isEnabled()) {
commandContext.getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, processDefinition),
EngineConfigurationConstants.KEY_PROCESS_ENGINE_CONFIG);
}
return null;View on GitHub (pinned to d6d39ce1c6)