flowable/flowable-engine · error · FlowableIllegalArgumentException
Request did not contain a list of variables to create.
Error message
Request did not contain a list of variables to create.
What it means
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.
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)
Example fix
// before
POST /runtime/process-instances/5001/variables body: []
// after
POST /runtime/process-instances/5001/variables body: [{"name":"x","type":"integer","value":1}] Defensive patterns
Strategy: validation
Validate before calling
if (!Array.isArray(variables) || variables.length === 0) throw new Error('refusing to POST empty variable list to Flowable'); Type guard
function hasVariables(vars) { return Array.isArray(vars) && vars.length > 0; } Try / catch
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'); } } Prevention
- 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
When it happens
Trigger: POSTing "[]" or an empty body to a variables collection endpoint (e.g. POST /runtime/process-instances/{id}/variables).
Common situations: 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.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Cannot set global variables on execution
- Execution ' ' does not have a variable ' ' in scope
- Failed to serialize to a RestVariable instance
- Historic process instance '" + processInstanceId + "'…
- Invalid body was supplied
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/a203435e51062f19.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseVariableCollectionResource.java:105
} else {
List<RestVariable> inputVariables = new ArrayList<>();
List<RestVariable> resultVariables = new ArrayList<>();
result = resultVariables;
try {
@SuppressWarnings("unchecked")
List<Object> variableObjects = (List<Object>) objectMapper.readValue(request.getInputStream(), List.class);
for (Object restObject : variableObjects) {
RestVariable restVariable = objectMapper.convertValue(restObject, RestVariable.class);
inputVariables.add(restVariable);
}
} catch (Exception e) {
throw new FlowableIllegalArgumentException("Failed to serialize to a RestVariable instance", e);
}
if (inputVariables == null || inputVariables.size() == 0) {
throw new FlowableIllegalArgumentException("Request did not contain a list of variables to create.");
}
RestVariableScope sharedScope = null;
RestVariableScope varScope = null;
Map<String, Object> variablesToSet = new HashMap<>();
for (RestVariable var : inputVariables) {
// Validate if scopes match
varScope = var.getVariableScope();
if (var.getName() == null) {
throw new FlowableIllegalArgumentException("Variable name is required");
}
if (varScope == null) {
varScope = RestVariableScope.LOCAL;
}
if (sharedScope == null) {
sharedScope = varScope;View on GitHub (pinned to d6d39ce1c6)