{"record":{"id":"cd7507c22a6d7b29","repo":"flowable/flowable-engine","slug":"only-binary-and-serializable-are-supported-as","errorCode":null,"errorMessage":"Only 'binary' and 'serializable' are supported as variable type.","messagePattern":"Only 'binary' and 'serializable' are supported as variable type\\.","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":348,"sourceCode":"                } 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);\n\n            } else if (isSerializableVariableAllowed) {\n                // Try deserializing the object\n                ObjectInputStream stream = new ObjectInputStream(file.getInputStream());\n                Object value = stream.readObject();","sourceCodeStart":330,"sourceCodeEnd":366,"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#L330-L366","documentation":"FlowableIllegalArgumentException thrown by setBinaryVariable when the optional 'variableType' form field is provided but is neither 'binary' nor 'serializable' (the two types CmmnRestResponseFactory supports for binary variables).","triggerScenarios":"Multipart binary variable upload with variableType=form, string, json, or any other unsupported string.","commonSituations":"Copy-pasting variableType values from the general (JSON) variable API, which supports many types; case-sensitivity mistakes ('Binary'); clients guessing the type field values.","solutions":["Set variableType=binary for raw bytes or variableType=serializable for Java-serialized objects.","Omit the variableType field entirely to default to 'binary'.","Use lowercase exact strings; any other type is rejected."],"exampleFix":"// before\n-F \"variableName=doc\" -F \"variableType=string\"\n// after\n-F \"variableName=doc\" -F \"variableType=binary\"   # or omit variableType","handlingStrategy":"validation","validationCode":"const ALLOWED = ['binary', 'serializable'];\nif (variableType && !ALLOWED.includes(variableType)) {\n  throw new Error(`variableType must be one of ${ALLOWED}, got '${variableType}'`);\n}","typeGuard":"function isBinaryVariableType(t) { return t == null || t === 'binary' || t === 'serializable'; }","tryCatchPattern":"try {\n  await uploadBinaryVariable(id, formData);\n} catch (e) {\n  if (/Only 'binary' and 'serializable'/.test(e.message)) throw new Error('Use variableType=binary or serializable, or omit it');\n  throw e;\n}","preventionTips":["Omit variableType to get the default 'binary'.","Use exactly the lowercase strings 'binary' or 'serializable'.","Do not reuse type names from the JSON variable API (string, integer, json...) on the binary endpoint."],"tags":["rest","validation","enum","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"}