{"record":{"id":"51a97ed219868d7c","repo":"flowable/flowable-engine","slug":"variable-name-is-required-51a97e","errorCode":null,"errorMessage":"Variable name is required","messagePattern":"Variable name is required","errorType":"http","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskResource.java","lineNumber":206,"sourceCode":"            throw new FlowableIllegalArgumentException(\"Task has no form defined\");\n        }\n        \n        FormInfo formInfo = taskService.getTaskFormModel(task.getId());\n        if (formHandlerRestApiInterceptor != null) {\n            return formHandlerRestApiInterceptor.convertTaskFormInfo(formInfo, task);\n        } else {\n            SimpleFormModel formModel = (SimpleFormModel) formInfo.getFormModel();\n            return restResponseFactory.getFormModelString(new FormModelResponse(formInfo, formModel));\n        }\n    }\n\n    protected void completeTask(Task task, TaskActionRequest actionRequest) {\n        TaskCompletionBuilder taskCompletionBuilder = taskService.createTaskCompletionBuilder();\n\n        if (actionRequest.getVariables() != null) {\n            for (RestVariable var : actionRequest.getVariables()) {\n                if (var.getName() == null) {\n                    throw new FlowableIllegalArgumentException(\"Variable name is required\");\n                }\n\n                Object actualVariableValue = restResponseFactory.getVariableValue(var);\n                if (var.getVariableScope() != null && RestVariable.RestVariableScope.LOCAL.equals(var.getVariableScope())) {\n                    taskCompletionBuilder.variableLocal(var.getName(), actualVariableValue);\n                } else {\n                    taskCompletionBuilder.variable(var.getName(), actualVariableValue);\n                }\n\n            }\n        }\n\n        if (actionRequest.getTransientVariables() != null) {\n            for (RestVariable var : actionRequest.getTransientVariables()) {\n                if (var.getName() == null) {\n                    throw new FlowableIllegalArgumentException(\"Transient variable name is required\");\n                }\n","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskResource.java#L188-L224","documentation":"When completing a task via the task action endpoint, each variable supplied in the 'variables' array must have a 'name'. A RestVariable with a null name is rejected with FlowableIllegalArgumentException (HTTP 400) because the completion builder cannot register an unnamed variable.","triggerScenarios":"POST /cmmn-runtime/tasks/{taskId} with action 'complete' and a body where any element of the variables array lacks the name field (null, absent, or explicitly null in JSON).","commonSituations":"Hand-written JSON payloads missing 'name'; client serializers dropping null fields and sending {\"value\":...} only; programmatic request construction with unset name.","solutions":["Ensure every object in the variables array includes a non-null name.","Validate the request body client-side before sending.","Fix client-side DTO mapping so the variable name is populated from your data source.","Remove malformed variable entries rather than sending them with an empty name."],"exampleFix":"// before\n{\"action\":\"complete\",\"variables\":[{\"value\":\"x\"}]}\n\n// after\n{\"action\":\"complete\",\"variables\":[{\"name\":\"myVar\",\"value\":\"x\"}]}","handlingStrategy":"validation","validationCode":"vars.forEach(v => { if (!v.name) throw new Error('every completion variable needs a name'); });","typeGuard":"const validVars = vars.filter(v => typeof v.name === 'string' && v.name.length > 0);","tryCatchPattern":"try { await api.post(`/cmmn-runtime/tasks/${id}`, body); } catch (e) { if (e.response && e.response.status === 400) { /* fix payload: add variable names */ } throw e; }","preventionTips":["Validate variable payloads client-side before sending","Ensure serializers keep the name field","Use typed DTOs that require name"],"tags":["rest-api","cmmn","validation","variables"],"backgroundTag":"missing-required-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}