flowable/flowable-engine · error · FlowableException

Error getting variable ${variable.getName()}

Error message

Error getting variable ${variable.getName()}

What it means

Generic FlowableException wrapper thrown when an IOException occurs while serializing the variable value to a byte stream in restVariableDataToRestResponse. It is not a client error per se; it indicates the server failed to read/serialize the variable's binary data.

Source

Thrown at modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/BaseVariableResource.java:163

        byte[] result = null;
        try {
            if (CmmnRestResponseFactory.BYTE_ARRAY_VARIABLE_TYPE.equals(variable.getType())) {
                result = (byte[]) variable.getValue();
                response.setContentType("application/octet-stream");

            } else if (CmmnRestResponseFactory.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);
            }
        } catch (IOException ioe) {
            throw new FlowableException("Error getting variable " + variable.getName(), ioe);
        }
        return result;
    }

    protected RestVariable constructRestVariable(String variableName, Object value, String caseInstanceId, int variableType, boolean includeBinary,
            RestVariableScope scope) {
        return restResponseFactory.createRestVariable(variableName, value, scope, caseInstanceId, variableType, includeBinary);
    }

    protected List<RestVariable> processCaseVariables(CaseInstance caseInstance) {

        // Check if it's a valid execution to get the variables for
        List<RestVariable> variables = addVariables(caseInstance);

        // Get unique variables from map
        List<RestVariable> result = new ArrayList<>(variables);
        return result;
    }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Inspect the wrapped IOException cause to identify serialization incompatibility (e.g. serialVersionUID mismatch or ClassNotFoundException).
  2. Ensure the variable value's class exists on the server classpath with a stable serialVersionUID.
  3. Delete and re-set the variable with a binary or JSON value instead of a Java-serialized object.
  4. Prefer 'binary' variables over 'serializable' to avoid class-versioning issues.

Example fix

// before
class OrderPayload implements Serializable { /* no serialVersionUID, class changed */ }
// after
class OrderPayload implements Serializable {
    private static final long serialVersionUID = 1L;
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  return getVariableData(id, name);
} catch (FlowableException e) {
  log.error("Variable {} data read failed: {}", name, e.getCause(), e);
  throw new ApiException("Variable data unreadable, re-upload the variable", e);
}

Prevention

When it happens

Trigger: GET .../variables/{name}/data on a serializable variable whose object cannot be written to ObjectOutputStream (non-serializable class, serialization version mismatch, corrupted stored bytes).

Common situations: A stored Java object's class was changed/redeployed with a different serialVersionUID; the value was stored by an older Flowable version; custom classes no longer on the server classpath.

Understand the failure class

Background: "JSON serialization failed", "not JSON serializable", "Failed to serialize": why JSON marshaling errors happen and how to fix them — this error's family across 46 libraries.

Related errors


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