{"record":{"id":"4e20adaa590469e0","repo":"flowable/flowable-engine","slug":"the-variable-does-not-have-a-binary-data-stream","errorCode":null,"errorMessage":"The variable does not have a binary data stream.","messagePattern":"The variable does not have a binary data stream\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"warning","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/history/caze/HistoricCaseInstanceVariableDataResource.java","lineNumber":81,"sourceCode":"    public byte[] getVariableData(@ApiParam(name = \"caseInstanceId\") @PathVariable(\"caseInstanceId\") String caseInstanceId, \n                    @ApiParam(name = \"variableName\") @PathVariable(\"variableName\") String variableName, HttpServletResponse response) {\n        try {\n            byte[] result = null;\n            RestVariable variable = getVariableFromRequest(true, caseInstanceId, variableName);\n            if (CmmnRestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE.equals(variable.getType())) {\n                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    public RestVariable getVariableFromRequest(boolean includeBinary, String caseInstanceId, String variableName) {\n        HistoricCaseInstance caseObject = getHistoricCaseInstanceFromRequest(caseInstanceId);\n\n        HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery()\n                        .caseInstanceId(caseObject.getId())\n                        .variableName(variableName)\n                        .singleResult();\n\n        if (variable == null || variable.getValue() == null) {","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/history/caze/HistoricCaseInstanceVariableDataResource.java#L63-L99","documentation":"FlowableObjectNotFoundException from the historic case instance variable data endpoint: the variable's value is not a byte-array/serializable type, so there is no binary stream to download. Only ByteArray and Serializable variables expose raw data.","triggerScenarios":"GET of variable data for a historic case variable whose stored value is a plain String/Integer/etc. rather than a byte[] or Serializable payload.","commonSituations":"Client assumes every variable has downloadable data; variable type changed between case versions (was a document byte array, now a string); querying the wrong variable name.","solutions":["Only request data endpoints for byte-array or serializable variables; read plain values via the variable JSON endpoint","Check the variable's type field in the variable response before fetching data","Fix the case definition so the variable is stored as byte array/Serializable if binary data is expected","Handle the 404/FlowableObjectNotFoundException client-side with a graceful fallback"],"exampleFix":"// before\nbyte[] data = restClient.getVariableData(caseId, varName); // fails for String vars\n// after\nVariableResponse v = restClient.getVariable(caseId, varName);\nbyte[] data = \"byteArray\".equals(v.getType()) ? restClient.getVariableData(caseId, varName) : null;","handlingStrategy":"try-catch","validationCode":"if (!\"byteArray\".equals(variable.getType()) && !\"serializable\".equals(variable.getType()))\n  return null; // no binary data to fetch","typeGuard":"boolean hasBinaryData(VariableResponse v) {\n  return \"byteArray\".equals(v.getType()) || \"serializable\".equals(v.getType());\n}","tryCatchPattern":"try { return resource.getVariableData(caseId, varName); }\ncatch (FlowableObjectNotFoundException e) {\n  log.info(\"Variable {} has no binary data\", varName);\n  return null;\n}","preventionTips":["Check the variable type field before calling the data endpoint","Read plain values via the normal variable JSON endpoint","Handle type changes in case definitions across versions"],"tags":["rest-api","variables","binary-data","not-found"],"backgroundTag":"resource-not-found","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"}