{"record":{"id":"243ceeaf7c0ca435","repo":"flowable/flowable-engine","slug":"unexpected-exception-getting-variable-data-243cee","errorCode":null,"errorMessage":"Unexpected exception getting variable data","messagePattern":"Unexpected exception getting variable data","errorType":"http","errorClass":"FlowableException","httpStatus":500,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/variable/VariableInstanceDataResource.java","lineNumber":75,"sourceCode":"                result = (byte[]) variable.getValue();\n                response.setContentType(\"application/octet-stream\");\n\n            } else if (CmmnRestResponseFactory.SERIALIZABLE_VARIABLE_TYPE.equals(variable.getType())) {\n                ByteArrayOutputStream buffer = new ByteArrayOutputStream();\n                ObjectOutputStream outputStream = new ObjectOutputStream(buffer);\n                outputStream.writeObject(variable.getValue());\n                outputStream.close();\n                result = buffer.toByteArray();\n                response.setContentType(\"application/x-java-serialized-object\");\n\n            } else {\n                throw new FlowableObjectNotFoundException(\"The variable does not have a binary data stream.\", null);\n            }\n            return result;\n\n        } catch (IOException ioe) {\n            // Re-throw IOException\n            throw new FlowableException(\"Unexpected exception getting variable data\", ioe);\n        }\n    }\n}\n","sourceCodeStart":57,"sourceCodeEnd":79,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/variable/VariableInstanceDataResource.java#L57-L79","documentation":"Generic FlowableException wrapping an unexpected IOException raised while serializing the variable value to bytes for the /data endpoint (e.g. object not actually serializable at write time or stream failure). It is a catch-all conversion of the underlying java.io.IOException.","triggerScenarios":"GET /cmmn-runtime/variable-instances/{id}/data where outputStream.writeObject(value) throws IOException - typically a variable value that is not Serializable despite reaching the serialization branch, or an in-memory buffer/IO failure.","commonSituations":"Custom variable types missing serialVersionUID or holding non-serializable fields; class of a stored serializable object missing on the server so writeObject/readObject fails; environment/IO problems on the server.","solutions":["Inspect the wrapped IOException cause in server logs for the real failure (NotSerializableException, ClassNotFoundException)","Make the variable's value type implement java.io.Serializable with a stable serialVersionUID and serializable fields","Fix server classpath so classes referenced by stored serialized objects are available","If only the value is needed, use the plain variable endpoint instead of binary /data"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { return fetchVariableData(id); } catch (FlowableException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) { log.error(\"variable data serialization failed\", cause); } throw e; }","preventionTips":["Ensure variable values implement Serializable with stable serialVersionUID","Keep classes referenced by serialized variables on the server classpath","Inspect the wrapped IOException cause for the root failure"],"tags":["rest-api","serialization","io"],"backgroundTag":"json-marshal-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"}