flowable/flowable-engine · error · FlowableException
Unexpected exception getting variable data
Error message
Unexpected exception getting variable data
What it means
While serializing or streaming the variable's binary value to the HTTP response, an IOException occurred; Flowable wraps it in a FlowableException with this generic message and the original cause attached. It signals an infrastructure/streaming failure rather than a business-rule violation.
Source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/history/HistoricDetailDataResource.java:86
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 detailId) {
Object value = null;
HistoricVariableUpdate variableUpdate = null;
HistoricDetail detailObject = historyService.createHistoricDetailQuery().id(detailId).singleResult();
if (detailObject instanceof HistoricVariableUpdate) {
variableUpdate = (HistoricVariableUpdate) detailObject;
value = variableUpdate.getValue();
}
if (restApiInterceptor != null) {
restApiInterceptor.accessHistoryDetailById(detailObject);
}
if (value == null) {
throw new FlowableObjectNotFoundException("Historic detail '" + detailId + "' does not have a variable value.", VariableInstanceEntity.class);View on GitHub (pinned to d6d39ce1c6)
Solutions
- Inspect the wrapped cause (getCause()) to identify the underlying IOException
- Ensure values stored as serializable variables implement Serializable with a stable serialVersionUID
- Catch FlowableException on this endpoint and retry or re-query via the JSON variable endpoint
- Verify sufficient memory and disk health on the REST server
Example fix
// before runtimeService.setVariable(taskId, "config", new NonSerializableConfig()) // after runtimeService.setVariable(taskId, "config", serializableConfig) // implements Serializable
Defensive patterns
Strategy: try-catch
Validate before calling
if (!Buffer.isBuffer(value) && typeof value !== 'object') {
throw new Error('Only serializable/binary values can be fetched via the data endpoint');
} Try / catch
try { return await getVariableData(detailId); } catch (e) { if (/Unexpected exception getting variable data/.test(e.message)) { log.error('cause:', e.cause); throw new StorageReadError(e); } throw e; } Prevention
- Store only Serializable objects with fixed serialVersionUID as variables
- Monitor server memory/IO health
- Prefer storing byte[] instead of arbitrary complex objects
When it happens
Trigger: IOException during outputStream.writeObject / toByteArray while building the response for GET /history/historic-detail/{detailId}/data, e.g. serialization of a non-serializable object reaching the byte-array path, or memory/IO failures.
Common situations: Storing objects that fail java serialization at runtime; low heap causing OutOfMemory wrapped as IOException paths; corrupted serialized payloads in the history table.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Failed to serialize to a RestVariable instance
- Unexpected error getting variable data
- Error writing app model to json
- Could not find a case instance with id '${caseInstanceId}'.
- Historic task instance '' variable value for couldn't be fo
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/f3ef25ed47fdc10e.
Report an issue: GitHub.