{"record":{"id":"e35121e0511eaa13","repo":"flowable/flowable-engine","slug":"value-of-type-value-getclass-is-not-supported","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/ApacheHttpComponentsFlowableHttpClient.java","lineNumber":274,"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                requestBase.setEntity(entityBuilder.build());\n            } else {\n                throw new FlowableException(\"org.apache.http.entity.mime.MultipartEntityBuilder is not present on the classpath.\"\n                        + \" Multi value parts cannot be used.\"\n                        + \" If you want to use, please make sure that the org.apache.httpcomponents:httpmime dependency is available\");\n            }\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                }\n            }","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-http-common/src/main/java/org/flowable/http/common/impl/apache/ApacheHttpComponentsFlowableHttpClient.java#L256-L292","documentation":"When building multipart bodies, setRequestEntity only supports String values (text parts, optionally with a mime type) — null values are skipped. Any other non-null object type is rejected with FlowableIllegalArgumentException naming the offending Java type, because there is no defined mapping to a MIME part.","triggerScenarios":"A multipart field (fieldValue / part value) in the HTTP task resolves to a non-String object — e.g. an Integer, byte[], Map, or POJO process variable — while the request has parts configured.","commonSituations":"Binding a numeric or binary variable from a previous service task into a multipart field; JSON-deserialized objects used directly as part values; forgetting to convert a file's bytes to a supported representation.","solutions":["Convert the value to String before the task (String.valueOf or serialization in a script/listener)","For binary content, check which part types the configured client supports and use the appropriate field type/format","Fix the variable producer so the bound variable is a String","Split the request: send non-string data as JSON body instead of multipart"],"exampleFix":"// before\nexecution.setVariable(\"amount\", 42); // bound to multipart field\n// after\nexecution.setVariable(\"amount\", String.valueOf(42));","handlingStrategy":"type-guard","validationCode":"Object v = execution.getVariable(\"partValue\");\nif (v != null && !(v instanceof String)) {\n    execution.setVariable(\"partValue\", String.valueOf(v));\n}","typeGuard":"boolean isMultipartCompatible(Object v) { return v == null || v instanceof String; }","tryCatchPattern":"try {\n    client.prepareRequest(requestInfo);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"not supported as multi part content\")) {\n        // stringify the offending variable and retry once\n    } else { throw e; }\n}","preventionTips":["Only bind String variables to multipart fields","Stringify/serialize non-String values in a preceding script or service task","Send structured/binary data as a JSON body or supported binary part instead of a generic value"],"tags":["flowable","multipart","type-mismatch","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"}