flowable/flowable-engine · error · FlowableException
Unexpected exception getting variable data
Error message
Unexpected exception getting variable data
What it means
This FlowableException wraps an IOException thrown while reading the binary/stream content of a runtime variable in the REST API. It indicates the server failed at the I/O level when serializing or deserializing the variable's data (e.g. reading a byte array or serializable object), not that the variable is missing. The original IOException is attached as the cause.
Source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/VariableInstanceDataResource.java:89
result = (byte[]) variable.getValue();
response.setContentType("application/octet-stream");
} else if (RestResponseFactory.SERIALIZABLE_VARIABLE_TYPE.equals(variable.getType())) {
try (ByteArrayOutputStream buffer = new ByteArrayOutputStream();
ObjectOutputStream outputStream = new ObjectOutputStream(buffer)) {
outputStream.writeObject(variable.getValue());
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 varInstanceId) {
VariableInstance varObject = runtimeService.createVariableInstanceQuery().id(varInstanceId).singleResult();
if (varObject == null) {
throw new FlowableObjectNotFoundException("Historic variable instance '" + varInstanceId + "' could not be found.", VariableInstanceEntity.class);
} else {
if (restApiInterceptor != null) {
restApiInterceptor.accessVariableInfoById(varObject);
}
return restResponseFactory.createRestVariable(varObject.getName(), varObject.getValue(), null, varInstanceId, RestResponseFactory.VARIABLE_VARINSTANCE, includeBinary);
}
}
}View on GitHub (pinned to d6d39ce1c6)
Solutions
- Inspect the wrapped IOException cause in logs to find the real I/O failure
- Re-set the variable with fresh binary/serializable content via the REST API to replace corrupted data
- Verify the flowable variable storage (DB blob columns) is intact and not truncated
- Upgrade/align Flowable version to get fixes for variable stream handling
Example fix
// before
RestVariable result = getVariableData(...); // throws opaque FlowableException
// after
try {
RestVariable result = getVariableData(...);
} catch (FlowableException e) {
logger.error("variable data I/O failed", e.getCause());
// re-set the variable or return 500 with cause detail
} Defensive patterns
Strategy: try-catch
Validate before calling
VariableInstance v = runtimeService.createVariableInstanceQuery().id(id).singleResult(); boolean safe = v != null && (v.getValue() instanceof byte[] || "serializable".equals(v.getType()));
Type guard
boolean hasBinaryStream(VariableInstance v) {
return v != null && v.getValue() instanceof byte[];
} Try / catch
try {
RestVariable data = resource.getVariableData(...);
} catch (FlowableException e) {
log.error("variable data I/O failure", e.getCause());
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "variable data unavailable");
} Prevention
- Confirm the variable type before requesting binary data
- Monitor variable blob integrity in the database
- Keep Flowable engine and classpaths consistent for serializable variables
- Always log the exception cause, not just the message
When it happens
Trigger: Calling GET on a variable instance data endpoint (VariableInstanceDataResource.getVariableData) where the variable holds binary or serializable data and the underlying stream read/write throws IOException, e.g. corrupted or unavailable variable byte content during toByteArray/writeObject.
Common situations: Large serialized variables whose stream fails mid-read; database storing truncated byte arrays; serialization incompatibility when the stored object graph cannot be written; environment/classloader issues during object serialization.
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
- Unexpected exception getting variable data
- Error getting variable " + variableName
- Unexpected exception getting variable data
- Error getting variable ${variable.getName()}
- Unexpected exception getting variable data
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/c593f99dc465ce4d.
Report an issue: GitHub.