{"record":{"id":"8aeb63e37f10fc65","repo":"flowable/flowable-engine","slug":"only-binary-and-serializable-are-supported-as-8aeb63","errorCode":null,"errorMessage":"Only 'binary' and 'serializable' are supported as variable type.","messagePattern":"Only 'binary' and 'serializable' are supported as variable type\\.","errorType":"http","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskVariableBaseResource.java","lineNumber":167,"sourceCode":"\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            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            RestVariableScope scope = RestVariableScope.LOCAL;\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(task, variableName, variableBytes, scope, isNew);\n\n            } else if (isSerializableVariableAllowed) {\n                // Try deserializing the object\n                ObjectInputStream stream = new ObjectInputStream(file.getInputStream());","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskVariableBaseResource.java#L149-L185","documentation":"This Flowable CMMN REST error is thrown by setBinaryVariable when a request body sets a variable type that is not 'binary' or 'serializable'. Binary variable upload endpoints only accept these two type strings; anything else is rejected before the variable is stored. It guards the special multipart upload path for raw byte content.","triggerScenarios":"POSTing/PUTting to the task binary variable endpoint (e.g. POST /cmmn-runtime/tasks/{taskId}/variables) with multipart content and a 'type' form field set to something other than 'binary' or 'serializable', e.g. 'string' or 'byte[]'.","commonSituations":"Developers copying JSON-variable type names ('string','integer','json') into the binary upload form field; API clients auto-generating type fields; confusion between the JSON variables endpoint and the binary content endpoint.","solutions":["Remove the 'type' form field entirely so the default 'binary' is used","Set the type field to 'binary' for raw bytes","Set the type field to 'serializable' only when uploading a Java-serialized object","Use the regular JSON variables endpoint instead if the value is a simple typed value"],"exampleFix":"// before (multipart form)\ntype=string\n// after\ntype=binary   (or omit the type field)","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set(['binary','serializable']);\nif (type && !ALLOWED.has(type)) throw new Error(`type must be 'binary' or 'serializable', got: ${type}`);","typeGuard":"const isBinaryType = (t) => t === undefined || t === null || t === 'binary' || t === 'serializable';","tryCatchPattern":null,"preventionTips":["Omit the type field unless uploading serialized objects","Never copy JSON variable type names into the binary endpoint","Keep binary uploads and JSON variable calls in separate client helpers"],"tags":["rest","cmmn","validation","variables"],"backgroundTag":"invalid-enum-value","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"}