{"record":{"id":"20783a3cb80f1fe1","repo":"flowable/flowable-engine","slug":"transient-variable-name-is-required","errorCode":null,"errorMessage":"Transient variable name is required","messagePattern":"Transient 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":222,"sourceCode":"            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\n                Object actualVariableValue = restResponseFactory.getVariableValue(var);\n                if (var.getVariableScope() != null && RestVariable.RestVariableScope.LOCAL.equals(var.getVariableScope())) {\n                    taskCompletionBuilder.transientVariableLocal(var.getName(), actualVariableValue);\n                } else {\n                    taskCompletionBuilder.transientVariable(var.getName(), actualVariableValue);\n                }\n            }\n        }\n\n        taskCompletionBuilder\n                .taskId(task.getId())\n                .formDefinitionId(actionRequest.getFormDefinitionId())\n                .outcome(actionRequest.getOutcome())\n                .complete();\n    }\n","sourceCodeStart":204,"sourceCodeEnd":240,"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#L204-L240","documentation":"Transient variables supplied when completing a task must each carry a name; an unnamed transient RestVariable triggers FlowableIllegalArgumentException (HTTP 400). Transient variables are not persisted, but they still need an identifier to be passed through the completion builder.","triggerScenarios":"POST /cmmn-runtime/tasks/{taskId} with action 'complete' and a transientVariables array containing an element whose name is null or missing.","commonSituations":"Constructing transient variable maps programmatically where the key wasn't copied into the RestVariable.name field; JSON payloads omitting name for transient entries.","solutions":["Set the name field on every transientVariables entry.","Validate the payload before sending.","Fix DTO/serializer mapping that loses the name for transient variables.","Drop transient variables that have no meaningful name and pass them differently."],"exampleFix":"// before\n{\"action\":\"complete\",\"transientVariables\":[{\"value\":42}]}\n\n// after\n{\"action\":\"complete\",\"transientVariables\":[{\"name\":\"tmpCount\",\"value\":42}]}","handlingStrategy":"validation","validationCode":"transientVars.forEach(v => { if (!v.name) throw new Error('transient variable missing name'); });","typeGuard":"const valid = tvs.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) { /* repair transientVariables payload */ } throw e; }","preventionTips":["Populate name from the map key when building RestVariable objects","Unit-test request body construction","Validate before send"],"tags":["rest-api","cmmn","validation","transient-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-18T16:30:33.424Z"}