{"record":{"id":"66899e06e30af8cc","repo":"flowable/flowable-engine","slug":"request-didn-t-contain-a-list-of-variables-to-crea","errorCode":null,"errorMessage":"Request didn't contain a list of variables to create.","messagePattern":"Request didn't contain a list of variables to create\\.","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/BaseVariableResource.java","lineNumber":218,"sourceCode":"\n            List<RestVariable> inputVariables = new ArrayList<>();\n            List<RestVariable> resultVariables = new ArrayList<>();\n            result = resultVariables;\n\n            try {\n                @SuppressWarnings(\"unchecked\")\n                List<Object> variableObjects = (List<Object>) objectMapper.readValue(request.getInputStream(), List.class);\n                for (Object restObject : variableObjects) {\n                    RestVariable restVariable = objectMapper.convertValue(restObject, RestVariable.class);\n                    inputVariables.add(restVariable);\n                }\n                \n            } catch (Exception e) {\n                throw new FlowableIllegalArgumentException(\"Failed to serialize to a RestVariable instance\", e);\n            }\n\n            if (inputVariables == null || inputVariables.size() == 0) {\n                throw new FlowableIllegalArgumentException(\"Request didn't contain a list of variables to create.\");\n            }\n\n            Map<String, Object> variablesToSet = new HashMap<>();\n            for (RestVariable var : inputVariables) {\n                if (var.getName() == null) {\n                    throw new FlowableIllegalArgumentException(\"Variable name is required\");\n                }\n\n                Object actualVariableValue = restResponseFactory.getVariableValue(var);\n                variablesToSet.put(var.getName(), actualVariableValue);\n            }\n\n            if (!variablesToSet.isEmpty()) {\n                variableInterceptor.createVariables(variablesToSet);\n                Map<String, Object> setVariables = null;\n                if (variableType == CmmnRestResponseFactory.VARIABLE_PLAN_ITEM || scope == RestVariableScope.LOCAL) {\n                    if (async) {\n                        runtimeService.setLocalVariablesAsync(instanceId, variablesToSet);","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/BaseVariableResource.java#L200-L236","documentation":"FlowableIllegalArgumentException thrown by createVariable when, after deserialization, the request contained no variables — the input list is null or empty. The endpoint requires at least one variable to create.","triggerScenarios":"POST .../variables with body [] or \"null\", or a body that deserialized to an empty list.","commonSituations":"Client builds the array dynamically and all entries got filtered out; template left placeholder empty array; copying an example request but leaving it empty.","solutions":["Include at least one variable object in the JSON array body.","Guard client code to skip the call when the variables map is empty.","Verify the request body is not stripped or transformed to empty by middleware."],"exampleFix":"// before\nif (vars.size() > 0) {} // request still sent when empty\ncurl -X POST .../variables -d '[]'\n// after\nif (!vars.isEmpty()) { callRestEndpoint(vars); }\n// or send at least one entry: [{\"name\":\"count\",\"type\":\"integer\",\"value\":1}]","handlingStrategy":"validation","validationCode":"if (!Array.isArray(vars) || vars.length === 0) {\n  throw new Error('Refusing to call createVariables with an empty list');\n}","typeGuard":"function hasVariables(v) { return Array.isArray(v) && v.length > 0; }","tryCatchPattern":"try {\n  await createVariables(id, vars);\n} catch (e) {\n  if (/didn't contain a list of variables/.test(e.message)) log.warn('No variables to set; skipping call');\n  else throw e;\n}","preventionTips":["Skip the REST call entirely when the variables map is empty.","Log the final request body before sending in development.","Validate payload templates after variable substitution."],"tags":["rest","validation","empty-request","variables"],"backgroundTag":"empty-required-field","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"}