{"record":{"id":"b7f4f99ed03e0ad6","repo":"flowable/flowable-engine","slug":"the-requested-activity-with-id-activityid-can-n","errorCode":null,"errorMessage":"The requested activity with id ${activityId} can not be enabled in ${execution}","messagePattern":"The requested activity with id (.+?) can not be enabled in (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ExecuteActivityForAdhocSubProcessCmd.java","lineNumber":72,"sourceCode":"        FlowNode foundNode = null;\n\n        // if sequential ordering, only one child execution can be active\n        if (adhocSubProcess.hasSequentialOrdering()) {\n            if (execution.getExecutions().size() > 0) {\n                throw new FlowableException(\"Sequential ad-hoc sub process in \" + execution + \" already has an active execution\");\n            }\n        }\n\n        for (FlowElement flowElement : adhocSubProcess.getFlowElements()) {\n            if (activityId.equals(flowElement.getId()) && flowElement instanceof FlowNode flowNode) {\n                if (flowNode.getIncomingFlows().size() == 0) {\n                    foundNode = flowNode;\n                }\n            }\n        }\n\n        if (foundNode == null) {\n            throw new FlowableException(\"The requested activity with id \" + activityId + \" can not be enabled in \" + execution);\n        }\n\n        ExecutionEntity activityExecution = CommandContextUtil.getExecutionEntityManager().createChildExecution(execution);\n        activityExecution.setCurrentFlowElement(foundNode);\n        CommandContextUtil.getAgenda().planContinueProcessOperation(activityExecution);\n\n        return activityExecution;\n    }\n\n}\n","sourceCodeStart":54,"sourceCodeEnd":83,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ExecuteActivityForAdhocSubProcessCmd.java#L54-L83","documentation":"After scanning the ad-hoc subprocess flow elements, if no FlowNode with the requested activityId (having incoming flows) is found, execute() throws FlowableException: the requested activity cannot be enabled in this ad-hoc subprocess.","triggerScenarios":"Calling ExecuteActivityForAdhocSubProcessCmd with an activityId that does not exist inside the ad-hoc subprocess, or that is not a FlowNode / has no incoming sequence flows.","commonSituations":"Typos or renamed activity ids after model changes; passing an id of an element outside the ad-hoc subprocess; targeting a start-event-only element without incoming flows.","solutions":["Verify the activityId exists as a FlowNode inside the adhocSubProcess element in the deployed BPMN","Ensure the target node has at least one incoming sequence flow (adhoc activity must be enterable)","Re-fetch the model from the deployment (repositoryService.getBpmnModel) instead of a stale local copy"],"exampleFix":"// before\nmanagementService.executeCommand(new ExecuteActivityForAdhocSubProcessCmd(execId, \"taskA\"));\n// after\nBpmnModel model = repositoryService.getBpmnModel(processDefinitionId);\nAdhocSubProcess adhoc = (AdhocSubProcess) model.getMainProcess().getFlowElement(\"adhoc1\");\nif (adhoc.getFlowElement(\"taskA\") != null) {\n    managementService.executeCommand(new ExecuteActivityForAdhocSubProcessCmd(execId, \"taskA\"));\n}","handlingStrategy":"validation","validationCode":"FlowElement el = bpmnModel.getMainProcess().getFlowElement(activityId);\nif (!(el instanceof FlowNode) || ((FlowNode) el).getIncomingFlows().isEmpty()) throw new IllegalArgumentException(\"activity not enabled-able: \" + activityId);","typeGuard":"boolean isEnabledAdhocActivity(AdhocSubProcess adhoc, String id) { return adhoc.getFlowElement(id) instanceof FlowNode fn && !fn.getIncomingFlows().isEmpty(); }","tryCatchPattern":"try { ... } catch (FlowableException e) { if (e.getMessage().contains(\"can not be enabled\")) { /* validate activityId against deployed model */ } else throw e; }","preventionTips":["Validate activityIds against the deployed BpmnModel, not a local editor copy","Ensure target ad-hoc nodes have incoming sequence flows","Update ids in calling code when the BPMN is refactored"],"tags":["flowable","adhoc-subprocess","invalid-activity-id"],"backgroundTag":"resource-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}