{"record":{"id":"7ceb2ad82a27cf28","repo":"appsmithorg/appsmith","slug":"pe-dse-5003-7ceb2a","errorCode":"PE-DSE-5003","errorMessage":"Unable to parse content. Expected an array or object of multipart data","messagePattern":"Unable to parse content\\. Expected an array or object of multipart data","errorType":"error_code","errorClass":"AppsmithPluginException","httpStatus":500,"severity":"error","filePath":"app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/restApiUtils/helpers/DataUtils.java","lineNumber":237,"sourceCode":"\n                final MultipartFormDataType multipartFormDataType =\n                        MultipartFormDataType.valueOf(property.getType().toUpperCase(Locale.ROOT));\n\n                switch (multipartFormDataType) {\n                    case TEXT:\n                        byte[] valueBytesArray = new byte[0];\n                        if (StringUtils.hasLength(String.valueOf(property.getValue()))) {\n                            valueBytesArray =\n                                    String.valueOf(property.getValue()).getBytes(StandardCharsets.ISO_8859_1);\n                        }\n                        bodyBuilder.part(key, valueBytesArray, MediaType.TEXT_PLAIN);\n                        break;\n                    case FILE:\n                        try {\n                            populateFileTypeBodyBuilder(bodyBuilder, property, outputMessage);\n                        } catch (IOException e) {\n                            e.printStackTrace();\n                            throw new AppsmithPluginException(\n                                    AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, ERROR_INVALID_MULTIPART_DATA);\n                        }\n                        break;\n                    case ARRAY:\n                        if (property.getValue() instanceof String) {\n                            final String value = (String) property.getValue();\n                            try {\n                                final JsonNode jsonNode = objectMapper.readTree(value);\n                                if (jsonNode.isArray()) {\n                                    for (JsonNode node : jsonNode) {\n                                        if (node.isTextual()) bodyBuilder.part(key, node.asText());\n                                        else bodyBuilder.part(key, node);\n                                    }\n                                } else {\n                                    bodyBuilder.part(key, value);\n                                }\n                            } catch (JsonProcessingException e) {\n                                bodyBuilder.part(key, value);","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/appsmithorg/appsmith/blob/8cd9021c24cdbea1c3c12c966073708e83db60c2/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/restApiUtils/helpers/DataUtils.java#L219-L255","documentation":"Thrown by DataUtils while building a multipart/form-data body when a part of type FILE triggers an IOException inside populateFileTypeBodyBuilder. The stack trace is printed via e.printStackTrace() (an anti-pattern) and the error is re-thrown as PLUGIN_DATASOURCE_ARGUMENT_ERROR with ERROR_INVALID_MULTIPART_DATA. The exception covers any I/O failure while materializing the file part, not just structural multipart problems.","triggerScenarios":"A multipart action with a FILE part whose value cannot be read or written: a base64 data URL that decodes to nothing, a file reference pointing to non-existent content, a stream that throws during copy to the output message, or an invalid base64 payload.","commonSituations":"Binding a FilePicker widget's files array into a multipart FILE field where the data URL is malformed; an API action referencing a file that was cleared from the Appsmith store; large-file uploads hitting a size/encoding issue.","solutions":["Inspect the server log for the printStackTrace output of the underlying IOException - it names the real cause.","Verify the FILE part value is a well-formed data URL (data:<mime>;base64,<content>) or a valid base64 string.","If binding from a FilePicker, confirm the file is still present and not cleared before the action runs.","Replace the e.printStackTrace() call with a proper log.error so future failures are diagnosable."],"exampleFix":"// before\n} catch (IOException e) {\n    e.printStackTrace();\n    throw new AppsmithPluginException(\n        AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR, ERROR_INVALID_MULTIPART_DATA);\n}\n\n// after\n} catch (IOException e) {\n    log.error(\"Failed to build multipart FILE part for key {}\", key, e);\n    throw new AppsmithPluginException(\n        AppsmithPluginError.PLUGIN_DATASOURCE_ARGUMENT_ERROR,\n        ERROR_INVALID_MULTIPART_DATA + \": \" + e.getMessage(), e);\n}","handlingStrategy":"try-catch","validationCode":"// For FILE-type multipart parts, validate the value is a usable data URL or base64\nObject v = property.getValue();\nif (v instanceof String) {\n    String s = (String) v;\n    if (s.startsWith(\"data:\") && !s.contains(\";base64,\")) {\n        throw new IllegalArgumentException(\"FILE part value is a data URL without base64 encoding\");\n    }\n}","typeGuard":"public static boolean looksLikeFilePart(Object v) {\n    if (!(v instanceof String)) return false;\n    String s = (String) v;\n    return s.startsWith(\"data:\") && s.contains(\";base64,\");\n}","tryCatchPattern":"try {\n    bodyData = dataUtils.parseRequestBody(contentType, body, encodeParams);\n} catch (AppsmithPluginException e) {\n    if (e.getMessage() != null && e.getMessage().contains(ERROR_INVALID_MULTIPART_DATA)) {\n        log.error(\"Multipart FILE part failed to build\", e);\n        throw new IllegalArgumentException(\"Failed to build multipart FILE part; check file content\", e);\n    }\n    throw e;\n}","preventionTips":["Replace e.printStackTrace() with proper logging in your fork.","Validate FILE part values are well-formed data URLs before submission.","Ensure FilePicker-bound files are still present when the action runs."],"tags":["multipart","rest-api","file-upload","io","datasource-config"],"backgroundTag":null,"analyzedSha":"8cd9021c24cdbea1c3c12c966073708e83db60c2","analyzedAt":"2026-08-12T22:14:19.293Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}