{"record":{"id":"76c2daeb7c23d285","repo":"flowable/flowable-engine","slug":"the-variable-does-not-have-a-binary-data-stream-76c2da","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":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/ExecutionVariableDataResource.java","lineNumber":79,"sourceCode":"        try {\n            byte[] result = null;\n\n            Execution execution = getExecutionFromRequestWithoutAccessCheck(executionId);\n            RestVariable variable = getVariableFromRequest(execution, variableName, scope, true);\n            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":61,"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#L61-L88","documentation":"FlowableObjectNotFoundException thrown by getVariableData when the requested variable exists but is not a binary/serializable type, so no binary data stream can be produced. Only byte-array and serializable variables have downloadable binary content via this endpoint.","triggerScenarios":"GET /runtime/executions/{executionId}/variables/{variableName}/data where the variable's type is a plain primitive (string, integer, boolean, date, etc.) rather than a binary or serializable variable.","commonSituations":"Clients assuming all variables have a binary data endpoint, requesting /data for a variable stored as a JSON string, scripts that fetch all variables' data uniformly without checking variable type first.","solutions":["Fetch the variable normally (GET .../variables/{variableName}) and read its value instead of the /data endpoint","Check the variable's type first (via the variables listing) and only call /data for binary or serializable types","Store the value as a byte array or serializable variable if binary retrieval is required","Handle the 404-style FlowableObjectNotFoundException response and fall back to the regular variable endpoint"],"exampleFix":"// before\nGET /runtime/executions/123/variables/status/data\n// after\nGET /runtime/executions/123/variables/status","handlingStrategy":"try-catch","validationCode":"const vars = await getExecutionVariables(id);\nconst v = vars.find(v => v.name === variableName);\nconst hasBinary = v && (v.type === \"binary\" || v.type === \"serializable\");\nif (!hasBinary) return await getPlainVariable(id, variableName);","typeGuard":"function hasBinaryStream(v) { return v != null && (v.type === \"binary\" || v.type === \"serializable\"); }","tryCatchPattern":"try { return await fetchVariableData(id, name); }\ncatch (e) { if (e.status === 404) return await fetchPlainVariable(id, name); throw e; }","preventionTips":["Only call the /data endpoint for binary or serializable variables","Check variable type via the variables listing first","Use the plain variable endpoint for primitives"],"tags":["rest","variables","binary-data"],"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"}