{"record":{"id":"6f408f2aa3417c03","repo":"flowable/flowable-engine","slug":"could-not-process-multipart-content-6f408f","errorCode":null,"errorMessage":"Could not process multipart content","messagePattern":"Could not process multipart content","errorType":"http","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseExecutionVariableResource.java","lineNumber":185,"sourceCode":"                stream.close();\n                \n            } else {\n                throw new FlowableContentNotSupportedException(\"Serialized objects are not allowed\");\n            }\n\n            RestVariable variable = null;\n            \n            if (!async) {\n                variable = getVariableFromRequestWithoutAccessCheck(execution, variableName, scope, false);\n                \n                // We are setting the scope because the fetched variable does not have it\n                variable.setVariableScope(scope);\n            }\n            \n            return variable;\n\n        } catch (IOException ioe) {\n            throw new FlowableIllegalArgumentException(\"Could not process multipart content\", ioe);\n        } catch (ClassNotFoundException ioe) {\n            throw new FlowableContentNotSupportedException(\"The provided body contains a serialized object for which the class was not found: \" + ioe.getMessage());\n        }\n\n    }\n\n    protected RestVariable setSimpleVariable(RestVariable restVariable, Execution execution, boolean isNew, boolean async) {\n        if (restVariable.getName() == null) {\n            throw new FlowableIllegalArgumentException(\"Variable name is required\");\n        }\n\n        // Figure out scope, revert to local if omitted\n        RestVariableScope scope = restVariable.getVariableScope();\n        if (scope == null) {\n            scope = RestVariableScope.LOCAL;\n        }\n\n        Object actualVariableValue = restResponseFactory.getVariableValue(restVariable);","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseExecutionVariableResource.java#L167-L203","documentation":"FlowableIllegalArgumentException wrapping an IOException from processing the multipart request body in setBinaryVariable. Reading the uploaded file stream (file.getInputStream()) or other multipart I/O failed, so the variable could not be stored; the original IOException is preserved as cause.","triggerScenarios":"Binary variable upload where obtaining/reading the MultipartFile stream throws IOException — interrupted upload, temp-dir failure, container-level multipart parsing errors.","commonSituations":"Servlet container temp directory full or read-only; request aborted by client mid-upload; multipart size limits causing premature stream termination; misconfigured multipart resolver.","solutions":["Check the wrapped IOException cause — usually container temp-dir or stream failure","Verify the servlet container's multipart temp directory exists and is writable","Increase max multipart/file size limits (server max-file-size, spring multipart settings)","Retry the upload with a complete, untruncated request body"],"exampleFix":"// before\n// server: default temp dir, no size config\n// after\n# application.properties\nspring.servlet.multipart.max-file-size=20MB\nspring.servlet.multipart.max-request-size=25MB","handlingStrategy":"try-catch","validationCode":"if (!file.exists() || file.length() == 0) throw new IllegalArgumentException(\"empty upload rejected before send\");\n// and confirm server limits accept the size before uploading","typeGuard":null,"tryCatchPattern":"try {\n    client.uploadBinaryVariable(executionId, name, file);\n} catch (HttpClientErrorException.BadRequest e) {\n    log.error(\"multipart processing failed\", e);\n    // check server temp dir / size limits, then retry\n}","preventionTips":["Keep server multipart temp storage healthy and writable","Set explicit multipart size limits on both client and server","Ensure uploads complete without client-side aborts","Retry transient upload failures with backoff"],"tags":["io","multipart","upload","rest-api"],"backgroundTag":"file-read-failed","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}