flowable/flowable-engine · error · FlowableForbiddenException
Cannot delete a task that is part of a case instance.
Error message
Cannot delete a task that is part of a case instance.
What it means
A FlowableForbiddenException thrown by deleteTask when the task is scoped to a CMMN case instance (scopeId set and scopeType == CMMN). Like process-linked tasks, case tasks cannot be removed through the standalone task delete endpoint.
Source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskResource.java:161
@ApiImplicitParam(name = "cascadeHistory", dataType = "string", value = "Whether or not to delete the HistoricTask instance when deleting the task (if applicable). If not provided, this value defaults to false.", paramType = "query"),
@ApiImplicitParam(name = "deleteReason", dataType = "string", value = "Reason why the task is deleted. This value is ignored when cascadeHistory is true.", paramType = "query")
})
@ApiResponses(value = {
@ApiResponse(code = 204, message = "Indicates the task was found and has been deleted. Response-body is intentionally empty."),
@ApiResponse(code = 403, message = "Indicates the requested task cannot be deleted because it’s part of a workflow."),
@ApiResponse(code = 404, message = "Indicates the requested task was not found.")
})
@DeleteMapping(value = "/runtime/tasks/{taskId}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteTask(@ApiParam(name = "taskId") @PathVariable String taskId, @ApiParam(hidden = true) @RequestParam(value = "cascadeHistory", required = false) Boolean cascadeHistory,
@ApiParam(hidden = true) @RequestParam(value = "deleteReason", required = false) String deleteReason) {
Task taskToDelete = getTaskFromRequestWithoutAccessCheck(taskId);
if (taskToDelete.getExecutionId() != null) {
// Can not delete a task that is part of a process instance
throw new FlowableForbiddenException("Cannot delete a task that is part of a process instance.");
} else if (taskToDelete.getScopeId() != null && ScopeTypes.CMMN.equals(taskToDelete.getScopeType())) {
throw new FlowableForbiddenException("Cannot delete a task that is part of a case instance.");
}
if (restApiInterceptor != null) {
restApiInterceptor.deleteTask(taskToDelete);
}
if (cascadeHistory != null) {
// Ignore delete-reason since the task-history (where the reason is
// recorded) will be deleted anyway
taskService.deleteTask(taskToDelete.getId(), cascadeHistory);
} else {
// Delete with delete-reason
taskService.deleteTask(taskToDelete.getId(), deleteReason);
}
}
@ApiOperation(value = "Get a task form", tags = {"Tasks"})
@ApiResponses(value = {View on GitHub (pinned to d6d39ce1c6)
Solutions
- Terminate the case or the case's plan item instead of deleting the task directly
- Use the CMMN REST API (case instances / plan items) to end the task via the engine
- Skip CMMN-scoped tasks in cleanup logic (check scopeId/scopeType)
Defensive patterns
Strategy: validation
Validate before calling
const task = await get('/runtime/tasks/'+taskId); if (task.scopeId != null && task.scopeType === 'cmmn') { /* use CMMN API instead */ } Type guard
function isCmmnTask(t) { return t.scopeId != null && t.scopeType === 'cmmn'; } Try / catch
catch (e) { if (e.status === 403 && /part of a case instance/.test(e.body && e.body.message)) { /* end via CMMN case/plan-item API */ } else throw e; } Prevention
- Check scopeId/scopeType before deleting runtime tasks
- Route CMMN tasks to the CMMN REST endpoints
- Exclude case tasks from BPMN-oriented cleanup scripts
When it happens
Trigger: DELETE /runtime/tasks/{taskId} on a task created inside a running CMMN case instance.
Common situations: Bulk task cleanup jobs crossing process and case tasks; applications mixing BPMN and CMMN engines unaware of scope rules.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Cannot delete a task that is part of a case instance.
- Cannot delete a task that is part of a process instance.
- Cannot delete a task that is part of a process instance.
- Task ${taskId} is not suspended, so can't be activated
- is created by the process engine and should be completed vi
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/3dea4a8b3dba4f6a.
Report an issue: GitHub.