{"record":{"id":"a203435e51062f19","repo":"flowable/flowable-engine","slug":"request-did-not-contain-a-list-of-variables-to-cre","errorCode":null,"errorMessage":"Request did not contain a list of variables to create.","messagePattern":"Request did not contain a list of variables to create\\.","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseVariableCollectionResource.java","lineNumber":105,"sourceCode":"        } else {\n\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            } 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 did not contain a list of variables to create.\");\n            }\n\n            RestVariableScope sharedScope = null;\n            RestVariableScope varScope = null;\n            Map<String, Object> variablesToSet = new HashMap<>();\n\n            for (RestVariable var : inputVariables) {\n                // Validate if scopes match\n                varScope = var.getVariableScope();\n                if (var.getName() == null) {\n                    throw new FlowableIllegalArgumentException(\"Variable name is required\");\n                }\n\n                if (varScope == null) {\n                    varScope = RestVariableScope.LOCAL;\n                }\n                if (sharedScope == null) {\n                    sharedScope = varScope;","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseVariableCollectionResource.java#L87-L123","documentation":"After successfully deserializing the request, createExecutionVariable checks that the resulting list is non-empty and throws FlowableIllegalArgumentException if inputVariables is null or has zero entries. An empty request body or an empty JSON array carries no variables to create, so the call is rejected.","triggerScenarios":"POSTing \"[]\" or an empty body to a variables collection endpoint (e.g. POST /runtime/process-instances/{id}/variables).","commonSituations":"Client code building the variable list from an empty map/array dynamically; a loop or filter that removed all entries before the request; template code with a placeholder that never got filled.","solutions":["Include at least one variable object in the JSON array","Guard client-side: skip the API call when the variables list is empty","Check the request body actually got populated before sending (log it in debug)"],"exampleFix":"// before\nPOST /runtime/process-instances/5001/variables  body: []\n// after\nPOST /runtime/process-instances/5001/variables  body: [{\"name\":\"x\",\"type\":\"integer\",\"value\":1}]","handlingStrategy":"validation","validationCode":"if (!Array.isArray(variables) || variables.length === 0) throw new Error('refusing to POST empty variable list to Flowable');","typeGuard":"function hasVariables(vars) { return Array.isArray(vars) && vars.length > 0; }","tryCatchPattern":"try { await api.post(url, vars); } catch (e) { if (e.message.includes('did not contain a list of variables')) { console.warn('skipped empty variable batch'); } }","preventionTips":["Short-circuit client-side when the batch is empty","Log the exact request body before sending","Build variables from sources that can be empty and check before submit"],"tags":["flowable","rest-api","variables","empty-payload"],"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-18T11:17:12.947Z"}