{"record":{"id":"d5ce8eb5c3464767","repo":"flowable/flowable-engine","slug":"unexpected-exception-when-deserializing-jpa-id-s-d5ce8e","errorCode":null,"errorMessage":"Unexpected exception when deserializing JPA id's","messagePattern":"Unexpected exception when deserializing JPA id's","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/variable/JPAEntityListVariableType.java","lineNumber":170,"sourceCode":"            return baos.toByteArray();\n        } catch (IOException ioe) {\n            throw new ActivitiException(\"Unexpected exception when serializing JPA id's\", ioe);\n        }\n    }\n\n    protected String[] deserializeIds(byte[] bytes) {\n        try {\n            ByteArrayInputStream bais = new ByteArrayInputStream(bytes);\n            ObjectInputStream in = new ObjectInputStream(bais);\n\n            Object read = in.readObject();\n            if (!(read instanceof String[])) {\n                throw new ActivitiIllegalArgumentException(\"Deserialized value is not an array of ID's: \" + read);\n            }\n\n            return (String[]) read;\n        } catch (IOException ioe) {\n            throw new ActivitiException(\"Unexpected exception when deserializing JPA id's\", ioe);\n        } catch (ClassNotFoundException e) {\n            throw new ActivitiException(\"Unexpected exception when deserializing JPA id's\", e);\n        }\n    }\n\n}\n","sourceCodeStart":152,"sourceCodeEnd":177,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/variable/JPAEntityListVariableType.java#L152-L177","documentation":"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.","triggerScenarios":"Corrupt or truncated byte payload in the variable table; stream version mismatch between serialized and deserializing JVMs; variable bytes written by incompatible serialization settings.","commonSituations":"Database truncation of byte arrays; restoring variables from backup/dump with corrupted BLOBs; cross-JDK serialization incompatibilities in clusters.","solutions":["Inspect the chained IOException cause for corruption details","Delete and recreate the affected variable with valid data","Validate DB column sizes and BLOB integrity for ACT_GE_BYTEARRAY rows","Ensure consistent JDK/serialization config across all cluster nodes"],"exampleFix":"// before\n// corrupted bytes -> IOException during readObject\n// after\nbyte[] bytes = valueFields.getBytes();\nif (bytes == null || bytes.length == 0) {\n    return new String[0]; // guard before deserializing\n}","handlingStrategy":"try-catch","validationCode":"byte[] bytes = valueFields.getBytes();\nif (bytes == null || bytes.length == 0) {\n    throw new IllegalStateException(\"Variable payload missing; cannot deserialize JPA ids\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    Object orders = runtimeService.getVariable(executionId, \"orders\");\n} catch (ActivitiException e) {\n    if (e.getCause() instanceof IOException) {\n        // payload corrupt: rebuild variable from source of truth\n    }\n    throw e;\n}","preventionTips":["Backup and verify BLOB integrity after DB restores","Watch for column truncation of byte arrays","Keep JDK serialization settings consistent across nodes"],"tags":["jpa","deserialization","io","activiti"],"backgroundTag":"file-read-failed","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}