# ProcessDefinition not found

**URL:** <https://forum.flowable.org/t/processdefinition-not-found/12366>\
**Category:** Flowable Engine\
**Created:** [August 4, 2025, 5:20am UTC](https://forum.flowable.org/t/processdefinition-not-found/12366 "2025-08-04T05:20:38Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![pchandle](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@pchandle](https://forum.flowable.org/u/pchandle)\
**Post date:** [August 4, 2025, 5:20am UTC](https://forum.flowable.org/t/processdefinition-not-found/12366/1 "2025-08-04T05:20:38Z")

</div>

When pods get old, flowable is unable to fetch the definition, returning it as null. Once the service is restarted it starts working and returns the definition for IDs which it failed to get before restarting.  
Snippet: repositoryService  
.createProcessDefinitionQuery()  
.processDefinitionId(workflowDefinitionId).singleResult();

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [August 4, 2025, 6:38am UTC](https://forum.flowable.org/t/processdefinition-not-found/12366/2 "2025-08-04T06:38:25Z")

</div>

Hey @pchandle,

That’s a bit strange. Flowable stores the data in the database, so I don’t see how the pod getting old would fail to retrieve the process definition.

Can you please provide some more information.

Cheers,  
Filip

---

<div class="post-metadata">

**Author:** ![pchandle](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@pchandle](https://forum.flowable.org/u/pchandle)\
**Post date:** [August 4, 2025, 8:09am UTC](https://forum.flowable.org/t/processdefinition-not-found/12366/3 "2025-08-04T08:09:32Z")

</div>

This piece of code is used to create a BPMN image of the definition… But before creating the image it tries to get the definition, it sends it as null. Although the definition is present in act\_re\_procdef table with valid information in act\_re\_deployment table as well. This has started recently(1-2months), while flowable was upgraded to 6.8.1 a long time ago. There were no changes made in code.  
Any idea what could have gone wrong and how to proceed?

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [August 4, 2025, 9:04am UTC](https://forum.flowable.org/t/processdefinition-not-found/12366/4 "2025-08-04T09:04:49Z")

</div>

Could you create a jUnit test?

---

<div class="post-metadata">

**Author:** ![pchandle](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@pchandle](https://forum.flowable.org/u/pchandle)\
**Post date:** [August 4, 2025, 9:29am UTC](https://forum.flowable.org/t/processdefinition-not-found/12366/5 "2025-08-04T09:29:02Z")

</div>

JUnits seems to pass, as at startup it works fine… when service is deployed it can fetch the definition and create BPMN image as expected… it is after few hours, the issue arises. It can’t fetch definition hence unable to create the BPMN image

---

<div class="post-metadata">

**Author:** ![valentin](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/valentin/32/3367_2.png) [@valentin](https://forum.flowable.org/u/valentin)\
**Post date:** [August 4, 2025, 10:00am UTC](https://forum.flowable.org/t/processdefinition-not-found/12366/6 "2025-08-04T10:00:55Z")

</div>

Do you have an exception or is the result of the `singleResult()` method `null`?

Also, what is the `workflowDefinitionId` at the time when you invoke at the time when it fails?

Valentin

---

<div class="post-metadata">

**Author:** ![pchandle](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@pchandle](https://forum.flowable.org/u/pchandle)\
**Post date:** [August 4, 2025, 10:17am UTC](https://forum.flowable.org/t/processdefinition-not-found/12366/7 "2025-08-04T10:17:23Z")

</div>

Some logs comparison:  
Before service redeploy(old pods running for 5-6+ hours): ProcessDefinition lookup for id=‘GB\_Flow\_21:3:f8576ffe-d8c6-4f2e-83f3-2c568e484955’ returned null

After service redeploy: ProcessDefinition lookup for id=‘GB\_Flow\_21:3:f8576ffe-d8c6-4f2e-83f3-2c568e484955’ returned ProcessDefinitionEntity[GB\_Flow\_21:3:f8576ffe-d8c6-4f2e-83f3-2c568e484955]  
These are logs for same workflowDefinitionId.

Generic Exception thrown if this helps:

com.sas.mkt.workflow.client.exception.WorkflowException: The system failed to find the workflow process definition.  
at com.sas.mkt.workflow.engine.services.impl.RepositoryServiceWrapperImpl.getEngineProcessDefinition(RepositoryServiceWrapperImpl.java:73)  
at com.sas.mkt.workflow.engine.services.impl.RepositoryServiceWrapperImpl.getWorkflowDefinitionDiagram(RepositoryServiceWrapperImpl.java:131)  
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java)  
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)  
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:569)  
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:359)  
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:723)  
at com.sas.mkt.workflow.engine.services.impl.RepositoryServiceWrapperImpl$$SpringCGLIB$$0.getWorkflowDefinitionDiagram()  
at com.sas.mkt.workflow.core.services.impl.WorkflowDefinitionServiceImpl.getWorkflowDefinitionImage(WorkflowDefinitionServiceImpl.java:882)  
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java)  
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)  
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:569)  
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:359)  
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:723)  
at com.sas.mkt.workflow.core.services.impl.WorkflowDefinitionServiceImpl$$SpringCGLIB$$0.getWorkflowDefinitionImage()  
at com.sas.mkt.workflow.rest.controllers.WorkflowDefinitionController.getWorkflowDefinitionDiagram(WorkflowDefinitionController.java:170)  
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java)  
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)  
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:569)  
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:257)  
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:190)  
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118)  
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:986)  
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:891)  
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)  
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1088)  
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:978)  
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)  
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903)  
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:527)  
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)  
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:614)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:195)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)  
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)  
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)  
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)  
… 72 frames truncated

---

<div class="post-metadata">

**Author:** ![valentin](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/valentin/32/3367_2.png) [@valentin](https://forum.flowable.org/u/valentin)\
**Post date:** [August 6, 2025, 12:14pm UTC](https://forum.flowable.org/t/processdefinition-not-found/12366/8 "2025-08-06T12:14:56Z")

</div>

There is no Flowable in this exception, so it’s hard to tell something useful out of it. Can you share the method `RepositoryServiceWrapperImpl.getEngineProcessDefinition`?

---

<div class="post-metadata">

**Author:** ![pchandle](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@pchandle](https://forum.flowable.org/u/pchandle)\
**Post date:** [August 6, 2025, 12:38pm UTC](https://forum.flowable.org/t/processdefinition-not-found/12366/9 "2025-08-06T12:38:59Z")

</div>

No flowable does not throw any exception…I did try to catch any exception form flowable earlier… here’s the method:  
@OverrideOverride  
public ProcessDefinition getEngineProcessDefinition(  
String workflowDefinitionId) throws WorkflowException {  
ProcessDefinition processDefinition = null;  
processDefinition = this.repositoryService  
.createProcessDefinitionQuery()  
.processDefinitionId(workflowDefinitionId).singleResult();  
logger.info(“GetBPMNImage:: ProcessDefinition lookup for id=‘{}’ returned {}”, workflowDefinitionId, processDefinition);  
if (processDefinition == null) {  
logger.error(“GetBPMNImage:: Could not find process definition for id='{}”, workflowDefinitionId);  
throw new WorkflowException(  
WorkflowMessageCode.WORKFLOW\_DEFINITION\_NOT\_FOUND);  
}  
return processDefinition;  
}

---

<div class="post-metadata">

**Author:** ![WelschChristopher](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/welschchristopher/32/2822_2.png) [@WelschChristopher](https://forum.flowable.org/u/WelschChristopher)\
**Post date:** [August 6, 2025, 12:49pm UTC](https://forum.flowable.org/t/processdefinition-not-found/12366/10 "2025-08-06T12:49:21Z")

</div>

Hey @pchandle,

it’s correct that flowable does not throw any exception for that query..

For me, there are only 2 possibilities:

1. Whatever value workflowDefinitionId has, it’s not a process definition Id.
2. At some time between you storing that definitionId and executing the query, the definition got undeployed.

Can you check where the actual value of workflowDefinitionId comes from or check if the DeleteDeploymentCmd got executed?

Greetings

Christopher

Edit: While restarting the pods, do you use the auto-deploy for your process definitions?  
Are the pods only for flowable, and not restarting the database?

---

<div class="post-metadata">

**Author:** ![pchandle](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@pchandle](https://forum.flowable.org/u/pchandle)\
**Post date:** [August 6, 2025, 2:31pm UTC](https://forum.flowable.org/t/processdefinition-not-found/12366/11 "2025-08-06T14:31:49Z")

</div>

Hey @WelschChristopher  
This is a log when system is able to find procdef: ProcessDefinition lookup for id=‘GB\_Flow\_21:3:f8576ffe-d8c6-4f2e-83f3-2c568e484955’ returned ProcessDefinitionEntity[GB\_Flow\_21:3:f8576ffe-d8c6-4f2e-83f3-2c568e484955]

There is no specific code written to undeploy the definition. Also there is no difference in details of act\_re\_procdef and act\_re\_deployment table when system works fine and when it dosent. All the details like id\_, deployment\_id\_ seems to vaild and related to each other.  
Complete service is restarted ie. workflow service that includes flowable as well. yes, autodeploy does run at service startup.

---

<div class="post-metadata">

**Author:** ![WelschChristopher](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/welschchristopher/32/2822_2.png) [@WelschChristopher](https://forum.flowable.org/u/WelschChristopher)\
**Post date:** [August 6, 2025, 2:46pm UTC](https://forum.flowable.org/t/processdefinition-not-found/12366/12 "2025-08-06T14:46:37Z")

</div>

Hey @pchandle ,

> [@pchandle](#):
>
> When pods get old

Flowable runs in a multi instance env?

Can you please log the query and it’s parameters when this happens?

To say it bluntly: If there is something fundamental wrong with querying definitions, that would pop up. Queries are not cached and fetch directly from the database. That leaves us only with your setup/configuration or custom code (In my opinion)

Greetings

Christopher

---

<div class="post-metadata">

**Author:** ![pchandle](https://avatars.discourse-cdn.com/v4/letter/p/87869e/32.png) [@pchandle](https://forum.flowable.org/u/pchandle)\
**Post date:** [August 22, 2025, 5:39am UTC](https://forum.flowable.org/t/processdefinition-not-found/12366/13 "2025-08-22T05:39:47Z")

</div>

Hi @WelschChristopher , I started flowable internal logs  
Failed:

 ![flowable failed](https://canada1.discourse-cdn.com/flex035/uploads/flowable/original/2X/a/adb7321eb8be820a2a699e38ead0cd08a1af321e.png)

Worked:

 ![flowabled worked](https://canada1.discourse-cdn.com/flex035/uploads/flowable/original/2X/5/572ccefa174854d85c28eb3992e97852951b2683.png)  
it looks like after service restart it is still querying the same Id, and is able to get it… While before service restart it couldn’t. Does flowable maintain internal cache and tries to fetch it from there?  
There is not deleteDeploymentCmd in the logs, so it dosent look like it got executed.  
Any idea how this could happen and how to fix it?
