{"record":{"id":"095e196b54b11d27","repo":"flowable/flowable-engine","slug":"the-provided-body-contains-a-serialized-object-for-095e19","errorCode":null,"errorMessage":"The provided body contains a serialized object for which the class was not found: ","messagePattern":"The provided body contains a serialized object for which the class was not found: ","errorType":"http","errorClass":"FlowableContentNotSupportedException","httpStatus":409,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskVariableBaseResource.java","lineNumber":198,"sourceCode":"                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.name(), 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);\n        setVariable(task, restVariable.getName(), actualVariableValue, scope, isNew);\n","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskVariableBaseResource.java#L180-L216","documentation":"FlowableContentNotSupportedException wrapping a ClassNotFoundException thrown while deserializing an uploaded 'serializable' variable: the JVM reading the stream cannot resolve the object's class. Message includes the missing class name.","triggerScenarios":"type='serializable' upload where the serialized object's class is not on the Flowable server's classpath, or its serialVersionUID differs from the server's version of the class.","commonSituations":"Custom DTO serialized by a client app but never deployed to the server; class package renamed between client and server versions; serialVersionUID mismatch after refactoring.","solutions":["Deploy the serialized object's class (same package, serialVersionUID) to the Flowable server's classpath","Prefer type='binary' or JSON to avoid Java serialization coupling between client and server","Fix serialVersionUID mismatches by aligning class versions across client and server","Upgrade/downgrade so client and server share the same library version producing the serialized class"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// only upload classes the server actually has\nClass.forName(className); // verify in a shared-module test before serializing","typeGuard":null,"tryCatchPattern":"try { uploadSerializable(obj) } catch (FlowableContentNotSupportedException e) { serializeAsJsonOrBinaryInstead(); }","preventionTips":["Share the exact class (package + serialVersionUID) between client and server","Prefer JSON over Java serialization across service boundaries","Pin matching Flowable/app versions on both ends"],"tags":["rest-api","serialization","classpath"],"backgroundTag":"class-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}