{"record":{"id":"2db811d82cb22522","repo":"flowable/flowable-engine","slug":"no-variable-name-was-found-in-request-body","errorCode":null,"errorMessage":"No variable name was found in request body.","messagePattern":"No variable name was found in request body\\.","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":343,"sourceCode":"            if (paramMap.get(parameterName).length > 0) {\n\n                if (\"scope\".equalsIgnoreCase(parameterName)) {\n                    variableScope = paramMap.get(parameterName)[0];\n\n                } else if (\"name\".equalsIgnoreCase(parameterName)) {\n                    variableName = paramMap.get(parameterName)[0];\n\n                } else if (\"type\".equalsIgnoreCase(parameterName)) {\n                    variableType = paramMap.get(parameterName)[0];\n                }\n            }\n        }\n\n        try {\n\n            // Validate input and set defaults\n            if (variableName == null) {\n                throw new FlowableIllegalArgumentException(\"No variable name was found in request body.\");\n            }\n\n            if (variableType != null) {\n                if (!CmmnRestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE.equals(variableType) && !CmmnRestResponseFactory.SERIALIZABLE_VARIABLE_TYPE.equals(variableType)) {\n                    throw new FlowableIllegalArgumentException(\"Only 'binary' and 'serializable' are supported as variable type.\");\n                }\n            } else {\n                variableType = CmmnRestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE;\n            }\n\n            if (variableScope != null) {\n                scope = RestVariable.getScopeFromString(variableScope);\n            }\n\n            if (variableType.equals(CmmnRestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE)) {\n                // Use raw bytes as variable value\n                byte[] variableBytes = IOUtils.toByteArray(file.getInputStream());\n                setVariable(instanceId, variableName, variableBytes, scope, isNew, async, variableInterceptor);","sourceCodeStart":325,"sourceCodeEnd":361,"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#L325-L361","documentation":"REST request-body validation in BaseVariableResource.setBinaryVariable (CMMN REST): a binary (multipart) variable was uploaded without a 'name' form field, so the engine has no variable name to store the binary stream under.","triggerScenarios":"POST/PUT binary variable upload missing the required form field 'variableName' next to the file part.","commonSituations":"Clients send only the file part assuming the filename is used; field misnamed ('name' instead of 'variableName'); building the multipart request programmatically and forgetting the text part.","solutions":["Add a form field named exactly \"variableName\" to the multipart request.","Ensure the field is sent as a regular text part, not another file part.","Check field spelling and case ('variableName', 'variableScope', 'variableType')."],"exampleFix":"// before\ncurl -F \"file=@doc.pdf\" .../variables\n// after\ncurl -F \"file=@doc.pdf\" -F \"variableName=orderDoc\" .../variables","handlingStrategy":"validation","validationCode":"if (!formData.get('variableName')) {\n  throw new Error('multipart body must include a variableName form field');\n}","typeGuard":"function hasVariableName(fd) { return typeof fd.get('variableName') === 'string' && fd.get('variableName').length > 0; }","tryCatchPattern":"try {\n  await uploadBinaryVariable(id, formData);\n} catch (e) {\n  if (/No variable name was found/.test(e.message)) throw new Error('Add -F \"variableName=<name>\" to the multipart request');\n  throw e;\n}","preventionTips":["Always append the text field \"variableName\" alongside the file part.","Keep a shared helper that builds the multipart body so fields are never forgotten.","Remember the filename is NOT used as the variable name."],"tags":["rest","multipart","missing-field","binary"],"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-14T11:17:12.474Z"}