flowable/flowable-engine · error · FlowableException

Could not find activity

Error message

Could not find activity ${activity} for processId ${processInstanceId} in defined timeout of ${timeout} ms.

What it means

FlowableProducer.signal waits for the process execution to arrive at the expected activity within a configurable timeout (default via endpoint's timeout/timeResolution). If after the timeout no execution is found at that activity, Flowable throws this FlowableException rather than triggering an execution that does not exist.

Solutions

  1. Increase the endpoint timeout (e.g. flowable:key:activity?timeout=30000 or dataFlowableEndpoint timeout property) so slow/async process paths can complete.
  2. Verify the process actually reaches the expected activity: check the activity name in the camel URI matches the BPMN wait-state (receiveTask/userTask) id.
  3. Ensure the Flowable job executor is enabled and running so async continuations move the process forward.
  4. Check process history/logs to confirm the process instance is still running and its path reaches the activity.

Example fix

// before
from("direct:start").to("flowable:myProcess:waitState?timeout=2000");
// after
from("direct:start").to("flowable:myProcess:waitState?timeout=60000");
Defensive patterns

Strategy: try-catch

Validate before calling

// verify the wait state exists in the deployed definition
ProcessDefinition def = repositoryService.createProcessDefinitionQuery()
    .processDefinitionKey("myProcess").latestVersion().singleResult();
if (def == null) throw new IllegalStateException("Process not deployed");
// increase timeout if async steps are involved

Try / catch

try {
    producer.process(exchange);
} catch (FlowableException e) {
    if (e.getMessage().startsWith("Could not find activity")) {
        // retry with larger timeout or inspect process state via runtimeService
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling a synchronous flowable: endpoint (FlowableProducer.process) where the target process does not reach the expected wait-state activity within the configured timeout: process path never reaches the activity, process instance already ended, wrong activity name, or the process is still busy in another service task.

Common situations: Process definition changed so the activity name in the camel URI no longer exists; process instance terminated/aborted while waiting; polling loops too short relative to async jobs needing job executor execution; job executor disabled so async steps never advance.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/64fbf40b9923c72f. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-camel/src/main/java/org/flowable/camel/FlowableProducer.java:147

                execution = runtimeService.createExecutionQuery()
                        .executionId(executionId)
                        .activityId(activity)
                        .singleResult();

            } else {
                execution = runtimeService.createExecutionQuery()
                        .processDefinitionKey(processKey)
                        .processInstanceId(processInstanceId)
                        .activityId(activity)
                        .singleResult();
            }

            if (execution != null) {
                break;
            }
        }
        if (execution == null) {
            throw new FlowableException("Could not find activity " + activity + " for processId " + processInstanceId +
                    " in defined timeout of " + timeout + " ms.");
        }

        runtimeService.setVariables(execution.getId(), ExchangeUtils.prepareVariables(exchange, getFlowableEndpoint()));
        runtimeService.trigger(execution.getId());
    }

    protected String findProcessInstanceId(Exchange exchange) {
        String processInstanceId = exchange.getProperty(PROCESS_ID_PROPERTY, String.class);
        if (processInstanceId != null) {
            return processInstanceId;
        }
        String key = exchange.getProperty(PROCESS_KEY_PROPERTY, String.class);
        ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceBusinessKey(key).singleResult();

        if (processInstance == null) {
            throw new FlowableException("Could not start process instance with business key " + key);
        }

View on GitHub (pinned to d6d39ce1c6)