{"record":{"id":"2476ff3b5ea3c2dc","repo":"flowable/flowable-engine","slug":"unexpected-error-getting-variable-data","errorCode":null,"errorMessage":"Unexpected error getting variable data","messagePattern":"Unexpected error 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/task/TaskVariableDataResource.java","lineNumber":84,"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 error getting variable data\", ioe);\n        }\n    }\n}\n","sourceCodeStart":66,"sourceCodeEnd":88,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/task/TaskVariableDataResource.java#L66-L88","documentation":"Generic FlowableException wrapping an IOException that occurred while serializing the variable value to the binary response stream in getVariableData. It indicates an I/O problem (e.g. writing the serialized object failed) rather than a validation problem. The original IOException is attached as the cause.","triggerScenarios":"GET /cmmn-runtime/tasks/{taskId}/variables/{name}/data where ObjectOutputStream.writeObject or the underlying ByteArrayOutputStream throws IOException — typically serialization of an object whose class is broken or not serializable at write time.","commonSituations":"Non-serializable object stored as a variable value in an older engine version; JVM serialization issues after class changes; stream closed prematurely.","solutions":["Inspect the cause IOException in server logs for the root serialization problem","Ensure the variable's value class implements Serializable with a stable serialVersionUID","Re-save the variable with a valid serializable or byte-array value","Fall back to reading the variable via the JSON variable endpoint"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { return await api.get(url, { responseType: 'arraybuffer' }); }\ncatch (e) { log.error('variable data fetch failed', e); return fallbackViaJsonEndpoint(name); }","preventionTips":["Keep variable value classes Serializable with fixed serialVersionUID","Monitor server logs for the wrapped IOException cause","Avoid storing complex non-serializable objects as variables"],"tags":["io","serialization","rest"],"backgroundTag":"file-write-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"}