{"record":{"id":"eb599de1b03fbd7e","repo":"flowable/flowable-engine","slug":"only-binary-and-serializable-are-supported-as-eb599d","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-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskVariableBaseResource.java","lineNumber":166,"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 (!RestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE.equals(variableType) && !RestResponseFactory.SERIALIZABLE_VARIABLE_TYPE.equals(variableType)) {\n                    throw new FlowableIllegalArgumentException(\"Only 'binary' and 'serializable' are supported as variable type.\");\n                }\n            } else {\n                variableType = RestResponseFactory.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(RestResponseFactory.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":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskVariableBaseResource.java#L148-L184","documentation":"FlowableIllegalArgumentException thrown by setBinaryVariable when the optional 'type' form field is present but is neither 'binary' nor 'serializable'. Only these two types are supported for binary variable uploads.","triggerScenarios":"Multipart variable upload with type=string/integer/json or any value other than the exact strings 'binary' or 'serializable'.","commonSituations":"Guessing type names instead of using the documented constants; passing the Java class name or the value's own type as the type field.","solutions":["Omit the type field entirely (defaults to 'binary')","Set type='binary' for byte data or type='serializable' for a Java-serialized object","Remove invalid type values like json/string — non-binary types must use the JSON variable endpoint instead"],"exampleFix":"// before\n-F \"name=myVar\" -F \"type=json\" -F \"file=@data.bin\"\n// after\n-F \"name=myVar\" -F \"type=binary\" -F \"file=@data.bin\"","handlingStrategy":"validation","validationCode":"if (type != null && !Set.of(\"binary\",\"serializable\").contains(type)) throw new IllegalArgumentException(\"type must be binary or serializable\");","typeGuard":null,"tryCatchPattern":"try { upload(...) } catch (FlowableIllegalArgumentException e) { retryWithoutTypeField(); }","preventionTips":["Omit the type field when unsure — it defaults to binary","Use constants, not literals, for the type value","Use the JSON variable endpoint for non-binary types"],"tags":["rest-api","multipart","validation","enum"],"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-18T11:17:12.947Z"}