flowable/flowable-engine · error · FlowableException

Error getting variable " + variableName

Error message

Error getting variable " + variableName

What it means

FlowableException wrapping an IOException thrown while producing the binary representation of an execution variable in the REST API. Serialization of the variable value (writeObject/toByteArray) failed at the I/O level; the variableName is included in the message and the IOException is the cause.

Source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseExecutionVariableResource.java:98

            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())) {
                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) {
            throw new FlowableException("Error getting variable " + variableName, ioe);
        }
    }

    protected RestVariable setBinaryVariable(MultipartHttpServletRequest request, Execution execution, boolean isNew, boolean async) {

        // Validate input and set defaults
        if (request.getFileMap().size() == 0) {
            throw new FlowableIllegalArgumentException("No file content was found in request body.");
        }

        // Get first file in the map, ignore possible other files
        MultipartFile file = request.getFile(request.getFileMap().keySet().iterator().next());

        if (file == null) {
            throw new FlowableIllegalArgumentException("No file content was found in request body.");
        }

        String variableScope = null;

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Read the wrapped IOException cause to identify the serialization failure
  2. Re-save the variable with a byte-array (binary) type instead of serializable object
  3. Ensure classes stored in serializable variables exist and share serialVersionUID across deployments
  4. Upgrade Flowable if the failure stems from a known stream-handling bug

Example fix

// before
runtimeService.setVariable(executionId, name, someNonSerializableObject);
// after
runtimeService.setVariable(executionId, name,
    SerializeUtil.serializeToBytes(someSerializableObject)); // store as binary
Defensive patterns

Strategy: try-catch

Validate before calling

Object value = variable.getValue();
if (value != null && !(value instanceof java.io.Serializable)) {
    throw new IllegalStateException("value must be Serializable to store as serializable variable");
}

Try / catch

try {
    byte[] data = client.getVariableData(executionId, name);
} catch (FlowableException | HttpServerErrorException e) {
    log.error("serialization failure for variable " + name, e.getCause());
}

Prevention

When it happens

Trigger: GET on an execution variable data endpoint where the variable value is serializable and ObjectOutputStream.writeObject or ByteArrayOutputStream.toByteArray throws IOException during response preparation.

Common situations: Non-serializable or broken object stored as a 'serializable' variable; JVM serialization version mismatch between stored data and current classes; storage I/O errors.

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


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