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 Flowable REST task variable data endpoint throws FlowableObjectNotFoundException when asked to return a variable's binary content but the variable's value is not serializable binary data (e.g. it is a plain string, integer, or other non-streamable type). The endpoint serializes the value with ObjectOutputStream only when the variable value is serializable; otherwise it cannot produce a binary stream and raises this error. It is a 404-style 'not found / not applicable' signal, since Flowable passes null for the object class.

Source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskVariableDataResource.java:78

            HttpServletResponse response) {
        try {
            byte[] result = null;

            RestVariable variable = getVariableFromRequest(taskId, variableName, scope, true);
            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 error getting variable data", ioe);
        }
    }
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Fetch the variable via GET /runtime/tasks/{taskId}/variables/{variableName} instead of the /data endpoint to get its JSON representation.
  2. Check the variable's type in the variables response; only Serializable (byte-array/serializable) variables have binary data.
  3. If you need binary content, create the variable as a Serializable or byte[] value (e.g. set "type":"serializable" or upload via multipart) before fetching /data.
  4. Handle 404 on the client and fall back to the regular variable endpoint.

Example fix

// before
curl http://host/flowable-rest/runtime/tasks/123/variables/orderDoc/data
// variable is a String, so it 404s with this message

// after
curl http://host/flowable-rest/runtime/tasks/123/variables/orderDoc
// returns {"name":"orderDoc","type":"string","value":"..."}
Defensive patterns

Strategy: validation

Validate before calling

const vars = await fetch(`/runtime/tasks/${taskId}/variables`).then(r => r.json());
const v = vars.find(x => x.name === variableName);
if (!v) throw new Error('variable not found');
if (v.type !== 'serializable' && v.type !== 'byte-array' && v.valueUrl == null) {
  // fetch JSON representation instead of /data
}

Type guard

function hasBinaryData(variable) {
  return variable != null &&
    (variable.type === 'serializable' || variable.type === 'byte-array') &&
    variable.valueUrl != null;
}

Try / catch

try {
  return await fetch(`${base}/runtime/tasks/${taskId}/variables/${name}/data`);
} catch (e) {
  if (e.status === 404) return fetch(`${base}/runtime/tasks/${taskId}/variables/${name}`); // JSON fallback
  throw e;
}

Prevention

When it happens

Trigger: GET /runtime/tasks/{taskId}/variables/{variableName}/data where variableName refers to a variable whose value is not a Serializable object (or null), e.g. a variable set as a String/Integer/Boolean via the variables REST API, while the caller expects binary (serialized-object) content.

Common situations: Client assumes every task variable has downloadable binary data; variables created as simple types (string, long, json) are fetched via the /data endpoint; mismatch between how the variable was created (simple JSON body) and how it is fetched (data endpoint); null-valued variables.

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/2f50a8c644a045aa. Report an issue: GitHub.