flowable/flowable-engine · error · FlowableIllegalArgumentException

Task has no form defined

Error message

Task has no form defined

What it means

GET /cmmn-runtime/tasks/{taskId}/form requires the task to have a form key defined; otherwise there is no form to return. The endpoint throws FlowableIllegalArgumentException (HTTP 400) when the task's formKey is empty and no form model can be fetched.

Source

Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskResource.java:188

            // 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 = {
            @ApiResponse(code = 200, message = "Indicates request was successful and the task form is returned"),
            @ApiResponse(code = 404, message = "Indicates the requested task was not found.")
    })
    @GetMapping(value = "/cmmn-runtime/tasks/{taskId}/form", produces = "application/json")
    public String getTaskForm(@ApiParam(name = "taskId") @PathVariable String taskId) {
        Task task = getTaskFromRequest(taskId);
        if (StringUtils.isEmpty(task.getFormKey())) {
            throw new FlowableIllegalArgumentException("Task has no form defined");
        }
        
        FormInfo formInfo = taskService.getTaskFormModel(task.getId());
        if (formHandlerRestApiInterceptor != null) {
            return formHandlerRestApiInterceptor.convertTaskFormInfo(formInfo, task);
        } else {
            SimpleFormModel formModel = (SimpleFormModel) formInfo.getFormModel();
            return restResponseFactory.getFormModelString(new FormModelResponse(formInfo, formModel));
        }
    }

    protected void completeTask(Task task, TaskActionRequest actionRequest) {
        TaskCompletionBuilder taskCompletionBuilder = taskService.createTaskCompletionBuilder();

        if (actionRequest.getVariables() != null) {
            for (RestVariable var : actionRequest.getVariables()) {
                if (var.getName() == null) {
                    throw new FlowableIllegalArgumentException("Variable name is required");

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Set a formKey on the human task in the CMMN model and redeploy the case definition.
  2. Use getTaskFormModel only after checking the task's formKey via GET /cmmn-runtime/tasks/{taskId} (formKey field).
  3. If no form is needed, don't call the form endpoint; render your own UI.
  4. Provide the form through a form-deployment referenced by the formKey so the model resolves.

Example fix

// before
GET /flowable-rest/cmmn-runtime/tasks/123/form  // 400 Task has no form defined

// after: check first
const task = await get(`/cmmn-runtime/tasks/123`);
if (task.formKey) { await get(`/cmmn-runtime/tasks/123/form`); }
Defensive patterns

Strategy: validation

Validate before calling

const task = await api.get(`/cmmn-runtime/tasks/${id}`);
if (!task.formKey) return null; // no form defined

Try / catch

try { return await api.get(`/cmmn-runtime/tasks/${id}/form`); } catch (e) { if (e.response && e.response.status === 400) return null; throw e; }

Prevention

When it happens

Trigger: Calling GET /cmmn-runtime/tasks/{taskId}/form for a task whose formKey was never set in the case model (human task without formKey attribute) or set to an empty string.

Common situations: Case diagrams where the human task element omits the form key; dynamic tasks created programmatically without a form key; clients assuming every task has a form.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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