{"record":{"id":"d042851fdc14d6cf","repo":"flowable/flowable-engine","slug":"the-provided-body-contains-a-serialized-object-for-d04285","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":415,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskVariableBaseResource.java","lineNumber":199,"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, 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":181,"sourceCodeEnd":217,"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#L181-L217","documentation":"FlowableContentNotSupportedException thrown when deserializing the uploaded object fails with ClassNotFoundException in setBinaryVariable. The request body contained a Java-serialized object whose class is not on the Flowable server's classpath, so the server cannot reconstruct it. The missing class name is appended to the message.","triggerScenarios":"Uploading type='serializable' content whose serialized stream references a class absent from the server's classpath — the ClassNotFoundException message names the missing class.","commonSituations":"Deploying a custom class version that was later renamed/refactored; server missing the client application's domain classes; different package names between client and server builds; running on Flowable server without the app's dependency jars.","solutions":["Add the missing class (named in the message) to the Flowable server classpath","Align package/class names between client and server deployments","Prefer JSON variables over Java serialization for portability","Include serialVersionUID-compatible class versions on both sides"],"exampleFix":"// before: uploading instance of com.myapp.CustomDto not present on server\n// after: add myapp-dto jar to server libs, or send JSON:\nPUT /cmmn-runtime/tasks/{id}/variables  {\"name\":\"v\",\"type\":\"string\",\"value\":\"...\"}","handlingStrategy":"try-catch","validationCode":"const isSerializableClass = (cls) => /* verify class name matches a class deployed on the server */ deployedClassNames.has(cls.name);","typeGuard":null,"tryCatchPattern":"try { await uploadSerializable(obj) } catch (e) { if (e.message.includes('class was not found')) deployMissingClass(e.cause) ?? useJsonInstead(obj); }","preventionTips":["Prefer JSON over Java serialization for REST variables","Keep client and server classpaths in sync (same jars/versions)","Pin serialVersionUID and avoid renaming serialized classes"],"tags":["serialization","classpath","javaclassnotfound"],"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"}