{"record":{"id":"91ff7327bffac0e2","repo":"flowable/flowable-engine","slug":"the-variable-does-not-have-a-binary-data-stream-91ff73","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-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseExecutionVariableResource.java","lineNumber":93,"sourceCode":"\n        try {\n            byte[] result = null;\n\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                try (ByteArrayOutputStream buffer = new ByteArrayOutputStream();\n                     ObjectOutputStream outputStream = new ObjectOutputStream(buffer)) {\n                    outputStream.writeObject(variable.getValue());\n                    result = buffer.toByteArray();\n                    response.setContentType(\"application/x-java-serialized-object\");\n                }\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    protected RestVariable setBinaryVariable(MultipartHttpServletRequest request, Execution execution, boolean isNew, boolean async) {\n\n        // Validate input and set defaults\n        if (request.getFileMap().size() == 0) {\n            throw new FlowableIllegalArgumentException(\"No file content was found in request body.\");\n        }\n\n        // Get first file in the map, ignore possible other files\n        MultipartFile file = request.getFile(request.getFileMap().keySet().iterator().next());\n","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseExecutionVariableResource.java#L75-L111","documentation":"FlowableObjectNotFoundException thrown by getVariableDataByteArray when a variable's value is neither a byte array nor a serializable object, so there is no binary data stream to return. The REST variable-data endpoint can only stream content for 'binary' and 'serializable' variable types.","triggerScenarios":"Requesting the data/content of a variable whose type is string, integer, date, etc. (any non-binary type) via the variable data resource.","commonSituations":"Client assumes every variable has downloadable content; requesting /data on a plain string variable; frontend generic variable-download code that ignores the variable type.","solutions":["Check the variable's type first and only request /data for 'binary' or 'serializable' variables","Fetch the variable's value via the normal variable endpoint instead of the data endpoint","Catch FlowableObjectNotFoundException and return 404/400 explaining no binary content exists"],"exampleFix":"// before\nbyte[] data = getVariableData(anyVariable); // throws for strings\n// after\nif (\"binary\".equals(var.getType()) || \"serializable\".equals(var.getType())) {\n    byte[] data = getVariableData(var);\n} else {\n    Object value = var.getValue(); // use plain value\n}","handlingStrategy":"type-guard","validationCode":"RestVariable meta = getVariableMetadata(name);\nif (!\"binary\".equals(meta.getType()) && !\"serializable\".equals(meta.getType())) {\n    // fetch plain value via variable endpoint instead\n}","typeGuard":"boolean hasDownloadableData(RestVariable v) {\n    return \"binary\".equals(v.getType()) || \"serializable\".equals(v.getType());\n}","tryCatchPattern":"try {\n    byte[] data = client.getVariableData(id);\n} catch (NotFoundException e) {\n    data = null; // no binary stream for this type\n}","preventionTips":["Only call the /data sub-resource for binary or serializable variables","Inspect variable type from the variable representation first","Handle 404 as 'no content' rather than an exceptional state"],"tags":["rest-api","variables","binary-data","not-supported"],"backgroundTag":"unsupported-operation","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}