{"record":{"id":"c47b19e4c20bfca7","repo":"flowable/flowable-engine","slug":"error-getting-variable-variablename-c47b19","errorCode":null,"errorMessage":"Error getting variable ${variableName}","messagePattern":"Error getting variable (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":500,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ExecutionVariableDataResource.java","lineNumber":84,"sourceCode":"            if (RestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE.equals(variable.getType())) {\n                result = (byte[]) variable.getValue();\n                response.setContentType(\"application/octet-stream\");\n\n            } else if (RestResponseFactory.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            throw new FlowableException(\"Error getting variable \" + variableName, ioe);\n        }\n    }\n}\n","sourceCodeStart":66,"sourceCodeEnd":88,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ExecutionVariableDataResource.java#L66-L88","documentation":"FlowableException wrapping an IOException thrown when reading or serializing the variable's binary data stream fails during getVariableData. It indicates an I/O problem (stream read/serialization failure), not that the variable is missing.","triggerScenarios":"GET /runtime/executions/{id}/variables/{name}/data where writing the variable value to the output stream or reading the request fails with an IOException, e.g. corrupt serializable payload or broken stream/pipe.","commonSituations":"Corrupted Java-serialized objects stored as serializable variables (e.g. class version mismatch on deserialization), client disconnecting mid-download, large variable exceeding stream/memory limits.","solutions":["Check the wrapped IOException cause in the server logs for the root failure","Re-save the variable value if the stored serialized object is corrupt or its class version changed","Ensure all classes stored in serializable variables are on the REST server's classpath with matching serialVersionUID","Retry the request; if it persists, avoid Java-serialized variables and use byte-array variables"],"exampleFix":"// before\nruntimeService.setVariable(executionId, \"payload\", new LegacyDto())\n// after\nruntimeService.setVariable(executionId, \"payload\", dtoBytes) // byte[] variable","handlingStrategy":"retry","validationCode":"// ensure the variable exists and is serializable-safe before reading\nconst v = await getExecutionVariables(id);\nif (v.find(x => x.name === name && x.type === \"serializable\")) verifyClassesOnServerClasspath();","typeGuard":null,"tryCatchPattern":"try { return await fetchVariableData(id, name); }\ncatch (e) { if (isRetryable(e)) return retry(fetchVariableData, [id, name], 2); throw e; }","preventionTips":["Keep classes of serialized variables on the server classpath with stable serialVersionUID","Prefer byte[] variables over Java-serialized objects","Retry transient IO failures; investigate persistent ones in server logs"],"tags":["rest","io","variables","serialization"],"backgroundTag":"file-read-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"}