{"record":{"id":"ccfebc996fbf2401","repo":"flowable/flowable-engine","slug":"value-of-type-value-getclass-is-not-supported-ccfebc","errorCode":null,"errorMessage":"Value of type ${value.getClass()} is not supported as multi part content","messagePattern":"Value of type (.+?) is not supported as multi part content","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/apache/client5/ApacheHttpComponents5FlowableHttpClient.java","lineNumber":272,"sourceCode":"            MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create();\n            entityBuilder.setMode(multipartMode);\n            for (MultiValuePart part : requestInfo.getMultiValueParts()) {\n                String name = part.getName();\n                Object value = part.getBody();\n                if (value instanceof byte[]) {\n                    if (StringUtils.isNotBlank(part.getMimeType())) {\n                        entityBuilder.addBinaryBody(name, (byte[]) value, ContentType.create(part.getMimeType()), part.getFilename());\n                    } else {\n                        entityBuilder.addBinaryBody(name, (byte[]) value, ContentType.DEFAULT_BINARY, part.getFilename());\n                    }\n                } else if (value instanceof String) {\n                    if (StringUtils.isNotBlank(part.getMimeType())) {\n                        entityBuilder.addTextBody(name, (String) value, ContentType.create(part.getMimeType()));\n                    } else {\n                        entityBuilder.addTextBody(name, (String) value);\n                    }\n                } else if (value != null) {\n                    throw new FlowableIllegalArgumentException(\"Value of type \" + value.getClass() + \" is not supported as multi part content\");\n                }\n            }\n\n            try (HttpEntity multiPartEntity = entityBuilder.build();\n                 ByteArrayOutputStream outputStream = new ByteArrayOutputStream((int) multiPartEntity.getContentLength())) {\n                multiPartEntity.writeTo(outputStream);\n                requestBase.setEntity(outputStream.toByteArray(), ContentType.parse(multiPartEntity.getContentType()));\n            } catch (IOException e) {\n                throw new FlowableException(\"Cannot create multi part entity\", e);\n            }\n        } else if (requestInfo.getFormParameters() != null) {\n            Map<String, List<String>> formParameters = requestInfo.getFormParameters();\n            List<BasicNameValuePair> parameters = new ArrayList<>(formParameters.size());\n            for (Map.Entry<String, List<String>> entry : formParameters.entrySet()) {\n                String name = entry.getKey();\n                for (String value : entry.getValue()) {\n                    parameters.add(new BasicNameValuePair(name, value));\n                }","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/apache/client5/ApacheHttpComponents5FlowableHttpClient.java#L254-L290","documentation":"When building a multipart body, `setRequestEntity` in the HttpClient 5.x client only accepts `String` and `byte[]` (or null, which is skipped) values for each part. Any other value type reaching this branch throws `FlowableIllegalArgumentException` naming the offending Java class.","triggerScenarios":"A multi value part parameter whose value is not a `String` or `byte[]` — e.g. an `Integer`, `File`, `InputStream`, or a serialized object placed directly into the part parameters map.","commonSituations":"Passing numbers/booleans from process variables straight into multipart parts without conversion; attempting to upload a `File` object instead of its bytes; scripting expressions producing non-string values.","solutions":["Convert the value to `String` (`String.valueOf(value)`) for text parts or `byte[]` for binary parts before adding it as a multipart part.","For files, read the content into a `byte[]` (`Files.readAllBytes(path)`) and supply that as the part value.","Fix the expression/variable mapping that injects the unsupported type into the multi value parts map."],"exampleFix":"// before\nparts.put(\"count\", someInteger); // FlowableIllegalArgumentException\n\n// after\nparts.put(\"count\", String.valueOf(someInteger));\nparts.put(\"file\", Files.readAllBytes(Paths.get(\"report.pdf\")));","handlingStrategy":"type-guard","validationCode":"boolean isSupportedPartValue(Object v) {\n    return v == null || v instanceof String || v instanceof byte[];\n}\n// validate every multi value part value before calling the client","typeGuard":"static boolean isMultipartPartValue(Object value) {\n    return value instanceof String || value instanceof byte[];\n}\n// usage: parts.values().forEach(v -> { if (!isMultipartPartValue(v)) throw new IllegalArgumentException(\"Part must be String or byte[], got \" + v.getClass()); });","tryCatchPattern":"try {\n    return client.call(requestInfo);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"not supported as multi part content\")) {\n        log.error(\"Convert multipart part values to String or byte[] before sending: {}\", e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Convert numbers/booleans with String.valueOf before adding parts.","Read File content into byte[] instead of passing File/InputStream objects.","Validate part value types at the boundary where parts are populated."],"tags":["multipart","type-mismatch","validation","http-client"],"backgroundTag":"type-mismatch","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"}