flowable/flowable-engine · error · FlowableException
Unexpected error getting variable data
Error message
Unexpected error getting variable data
What it means
This FlowableException wraps any IOException that occurs while the task variable data endpoint serializes the variable value into a byte array (ObjectOutputStream -> ByteArrayOutputStream). Serialization of the variable's value failed unexpectedly, so the REST layer aborts with a generic 500-style server error. Unlike the not-found case, this indicates the variable looked binary but the I/O/serialization step itself blew up.
Source
Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskVariableDataResource.java:84
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
- Inspect the cause (FlowableException#getCause) to find the underlying IOException and fix it (usually a missing class on the REST app classpath).
- Ensure the class of the serialized variable value is available to the flowable-rest application's classpath.
- Re-create the variable value as byte[] or a simple serializable type instead of a custom class.
- If the stored value is corrupt, delete and re-set the variable, then retry the request.
Example fix
// before: variable stores an app-specific object not on REST classpath runtimeService.setVariable(taskId, "doc", new OrderDocument()); // after: store plain serializable content runtimeService.setVariable(taskId, "doc", orderDocument.toByteArray());
Defensive patterns
Strategy: try-catch
Try / catch
try {
const resp = await fetch(`${base}/runtime/tasks/${taskId}/variables/${name}/data`);
if (!resp.ok) {
const body = await resp.text();
if (resp.status === 500) logServerErrorCause(body); // inspect cause IOException server-side
throw new Error(`variable data failed: ${resp.status} ${body}`);
}
return resp.arrayBuffer();
} catch (e) {
console.error('variable data serialization failed; check server logs for cause class', e);
throw e;
} Prevention
- Only store classes on variables that are on the REST application's classpath.
- Prefer byte[] or java.io.Serializable simple values over custom domain classes in variables.
- After classpath changes or upgrades, re-verify stored serializable variables can be read.
- Log FlowableException cause chain server-side to pinpoint the missing class.
When it happens
Trigger: GET /runtime/tasks/{taskId}/variables/{variableName}/data where the variable value IS serializable but ObjectOutputStream.writeObject throws an IOException during serialization (e.g. the stored object's class is not on the REST app's classpath, or an underlying stream/byte-array failure occurs).
Common situations: Serializable variable whose class was deployed in a different app/module so deserialization/serialization of fields fails (ClassNotFoundException wrapped in IOException); corrupted stored variable values; app classpath changes after the variable was stored.
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
- Unexpected exception getting variable data
- Unexpected exception getting variable data
- Unexpected exception getting variable data
- Error getting variable " + variableName
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/5938f8bf9c10e2c6.
Report an issue: GitHub.