flowable/flowable-engine · error · FlowableObjectNotFoundException

The variable does not have a binary data stream.

Error message

The variable does not have a binary data stream.

What it means

The variable data endpoint streams the variable's raw bytes, but only for byte-array/binary/serializable variables. When the fetched historic variable holds no binary payload (e.g. a plain string/number variable, or a serializable whose value is null), FlowableObjectNotFoundException "The variable does not have a binary data stream." is thrown.

Source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/history/HistoricProcessInstanceVariableDataResource.java:81

    public byte[] getVariableData(@ApiParam(name = "processInstanceId") @PathVariable("processInstanceId") String processInstanceId, 
                    @ApiParam(name = "variableName") @PathVariable("variableName") String variableName, HttpServletResponse response) {
        try {
            byte[] result = null;
            RestVariable variable = getVariableFromRequest(true, processInstanceId, variableName);
            if (RestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE.equals(variable.getType())) {
                result = (byte[]) variable.getValue();
                response.setContentType("application/octet-stream");

            } else if (RestResponseFactory.SERIALIZABLE_VARIABLE_TYPE.equals(variable.getType())) {
                ByteArrayOutputStream buffer = new ByteArrayOutputStream();
                ObjectOutputStream outputStream = new ObjectOutputStream(buffer);
                outputStream.writeObject(variable.getValue());
                outputStream.close();
                result = buffer.toByteArray();
                response.setContentType("application/x-java-serialized-object");

            } else {
                throw new FlowableObjectNotFoundException("The variable does not have a binary data stream.", null);
            }
            return result;

        } catch (IOException ioe) {
            // Re-throw IOException
            throw new FlowableException("Unexpected exception getting variable data", ioe);
        }
    }

    public RestVariable getVariableFromRequest(boolean includeBinary, String processInstanceId, String variableName) {

        HistoricProcessInstance processObject = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).includeProcessVariables().singleResult();

        if (processObject == null) {
            throw new FlowableObjectNotFoundException("Historic process instance '" + processInstanceId + "' could not be found.", HistoricProcessInstanceEntity.class);
        }
        
        if (restApiInterceptor != null) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Check the variable's type via the variable endpoint (GET .../variables/{name}) and only call /data for binary/serializable/byte-array types
  2. Read non-binary values from the variable's value field instead of the data endpoint
  3. Fix the variable's type at write time if it should have been a byte array

Example fix

// before
GET /history/process-instances/pi-1/variables/approver/data      // string variable -> 404
// after
GET /history/process-instances/pi-1/variables/approver            // plain value
// or, for binaries:
GET /history/process-instances/pi-1/variables/attachmentBytes/data
Defensive patterns

Strategy: validation

Validate before calling

const v = await get(`/history/process-instances/${pid}/variables/${name}`); if (!['binary','byteArray','serializable'].includes(v.type)) throw new Error('not a binary variable');

Type guard

const isBinaryType = (v) => ['binary','byteArray','serializable'].includes(v?.type);

Try / catch

catch (e) { if (e.response && e.response.status === 404 && /binary data stream/.test(e.response.data.message)) { /* fall back to plain value endpoint */ } throw e; }

Prevention

When it happens

Trigger: GET /history/process-instances/{id}/variables/{name}/data on a variable whose type is not byte-array, binary, or serializable (or a serializable variable with null value).

Common situations: Iterating all variables and requesting /data for each without checking type; variables whose type changed between engine versions; requesting data endpoints for string variables stored by custom field UIs.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/c43488d444d45a9c. Report an issue: GitHub.