{"record":{"id":"9b3b2ccfe36cf7b8","repo":"flowable/flowable-engine","slug":"error-getting-binary-variable","errorCode":null,"errorMessage":"Error getting binary variable","messagePattern":"Error getting binary variable","errorType":"http","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskVariableBaseResource.java","lineNumber":197,"sourceCode":"                // Use raw bytes as variable value\n                byte[] variableBytes = IOUtils.toByteArray(file.getInputStream());\n                setVariable(task, variableName, variableBytes, scope, isNew);\n\n            } else if (isSerializableVariableAllowed) {\n                // Try deserializing the object\n                ObjectInputStream stream = new ObjectInputStream(file.getInputStream());\n                Object value = stream.readObject();\n                setVariable(task, variableName, value, scope, isNew);\n                stream.close();\n\n            } else {\n                throw new FlowableContentNotSupportedException(\"Serialized objects are not allowed\");\n            }\n\n            return getVariableFromRequestWithoutAccessCheck(task, variableName, scope, false);\n\n        } catch (IOException ioe) {\n            throw new FlowableIllegalArgumentException(\"Error getting binary variable\", 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, Task task, boolean isNew) {\n        if (restVariable.getName() == null) {\n            throw new FlowableIllegalArgumentException(\"Variable name is required\");\n        }\n\n        // Figure out scope, revert to local is omitted\n        RestVariableScope scope = restVariable.getVariableScope();\n        if (scope == null) {\n            scope = RestVariableScope.LOCAL;\n        }\n\n        Object actualVariableValue = restResponseFactory.getVariableValue(restVariable);","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskVariableBaseResource.java#L179-L215","documentation":"FlowableIllegalArgumentException wrapping an IOException raised while reading the uploaded binary variable content from the request stream in setBinaryVariable. It means the raw multipart content could not be read (stream errors, client disconnect, malformed multipart body). The original IOException is attached as the cause.","triggerScenarios":"POSTing binary variable content where the multipart stream fails mid-read: truncated upload, invalid multipart encoding, network interruption between client and server, or servlet container failing to provide the file part.","commonSituations":"Proxy or load balancer cutting off large uploads; clients sending chunked/defective multipart bodies; timeouts on slow uploads of large files.","solutions":["Retry the upload ensuring the client sends a well-formed multipart body","Check server/proxy logs for the wrapped IOException cause","Increase proxy/body size limits and timeouts for large binaries","Verify client library multipart encoding (boundary, headers)","Capture the response body which includes the cause message"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if (fileBuffer.length === 0) throw new Error('refusing to upload empty binary payload');","typeGuard":null,"tryCatchPattern":"try { await upload(...) } catch (e) { if (isTransient(e)) return retryWithBackoff(upload); throw new Error('binary upload failed: ' + e.cause); }","preventionTips":["Increase proxy timeout/size limits for large uploads","Send well-formed multipart bodies (correct boundary/content-length)","Verify network stability between client and Flowable server"],"tags":["rest","io","upload","multipart"],"backgroundTag":"http-request-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"}