flowable/flowable-engine · error · ActivitiException

Unexpected exception when deserializing JPA id's

Error message

Unexpected exception when deserializing JPA id's

What it means

Thrown by JPAEntityListVariableType.deserializeIds() when ObjectInputStream.readObject() fails with IOException while reconstructing the String[] of entity IDs from the variable's stored bytes. Wrapped in ActivitiException with a generic message; the cause carries the detail.

Solutions

  1. Inspect the chained IOException cause for corruption details
  2. Delete and recreate the affected variable with valid data
  3. Validate DB column sizes and BLOB integrity for ACT_GE_BYTEARRAY rows
  4. Ensure consistent JDK/serialization config across all cluster nodes

Example fix

// before
// corrupted bytes -> IOException during readObject
// after
byte[] bytes = valueFields.getBytes();
if (bytes == null || bytes.length == 0) {
    return new String[0]; // guard before deserializing
}
Defensive patterns

Strategy: try-catch

Validate before calling

byte[] bytes = valueFields.getBytes();
if (bytes == null || bytes.length == 0) {
    throw new IllegalStateException("Variable payload missing; cannot deserialize JPA ids");
}

Try / catch

try {
    Object orders = runtimeService.getVariable(executionId, "orders");
} catch (ActivitiException e) {
    if (e.getCause() instanceof IOException) {
        // payload corrupt: rebuild variable from source of truth
    }
    throw e;
}

Prevention

When it happens

Trigger: Corrupt or truncated byte payload in the variable table; stream version mismatch between serialized and deserializing JVMs; variable bytes written by incompatible serialization settings.

Common situations: Database truncation of byte arrays; restoring variables from backup/dump with corrupted BLOBs; cross-JDK serialization incompatibilities in clusters.

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/d5ce8eb5c3464767. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/variable/JPAEntityListVariableType.java:170

            return baos.toByteArray();
        } catch (IOException ioe) {
            throw new ActivitiException("Unexpected exception when serializing JPA id's", ioe);
        }
    }

    protected String[] deserializeIds(byte[] bytes) {
        try {
            ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
            ObjectInputStream in = new ObjectInputStream(bais);

            Object read = in.readObject();
            if (!(read instanceof String[])) {
                throw new ActivitiIllegalArgumentException("Deserialized value is not an array of ID's: " + read);
            }

            return (String[]) read;
        } catch (IOException ioe) {
            throw new ActivitiException("Unexpected exception when deserializing JPA id's", ioe);
        } catch (ClassNotFoundException e) {
            throw new ActivitiException("Unexpected exception when deserializing JPA id's", e);
        }
    }

}

View on GitHub (pinned to d6d39ce1c6)