{"record":{"id":"19be229e46b437ce","repo":"flowable/flowable-engine","slug":"only-binary-and-serializable-are-supported-as-19be22","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":"warning","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseExecutionVariableResource.java","lineNumber":146,"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 (!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(execution, variableName, variableBytes, scope, isNew, async);\n\n            } else if (isSerializableVariableAllowed) {\n                // Try deserializing the object\n                ObjectInputStream stream = new ObjectInputStream(file.getInputStream());","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseExecutionVariableResource.java#L128-L164","documentation":"FlowableIllegalArgumentException thrown when the optional variable_type field is provided but is neither 'binary' nor 'serializable'. The binary-variable upload endpoint only supports these two types; any other declared type is rejected, while omitting the field defaults to 'binary'.","triggerScenarios":"Multipart variable upload including variable_type=string/integer/long/etc., or a typo like 'byte-array' instead of 'binary'.","commonSituations":"Clients copying the type names from general variable APIs where other types exist; case-sensitivity mistakes ('Binary' vs 'binary'); assuming type matching the actual content type.","solutions":["Set variable_type to exactly 'binary' or 'serializable', or omit the field entirely to default to binary","If the variable should hold a primitive/string value, use the JSON variable PUT endpoint instead of the binary upload","Catch FlowableIllegalArgumentException and return 400 listing allowed values"],"exampleFix":"// before\n-F \"variable_type=string\"\n// after\n-F \"variable_type=binary\"","handlingStrategy":"validation","validationCode":"if (variableType != null && !Set.of(\"binary\",\"serializable\").contains(variableType)) {\n    throw new IllegalArgumentException(\"variable_type must be 'binary' or 'serializable' (or omitted)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    client.uploadBinaryVariable(executionId, name, file, type);\n} catch (HttpClientErrorException.BadRequest e) {\n    // correct variable_type and retry\n}","preventionTips":["Omit variable_type to accept the 'binary' default","Use only the exact lowercase literals 'binary' and 'serializable'","For non-binary values use the JSON variable endpoint instead"],"tags":["rest-api","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-18T11:17:12.947Z"}