{"record":{"id":"2f659171072563f8","repo":"flowable/flowable-engine","slug":"error-while-executing-transformation-from-object","errorCode":null,"errorMessage":"Error while executing transformation from object:  using transformer ","messagePattern":"Error while executing transformation from object:  using transformer ","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/transformer/AbstractTransformer.java","lineNumber":30,"sourceCode":" */\npackage org.flowable.engine.impl.transformer;\n\nimport org.flowable.common.engine.api.FlowableException;\n\n/**\n * A Transformer is responsible of transforming an object into a different object\n * \n * @author Esteban Robles Luna\n */\npublic abstract class AbstractTransformer implements Transformer {\n\n    @Override\n    public Object transform(Object anObject) {\n        try {\n            return this.primTransform(anObject);\n        } catch (Exception e) {\n\n            throw new FlowableException(\"Error while executing transformation from object: \" + anObject + \" using transformer \" + this, e);\n        }\n    }\n\n    /**\n     * Transforms anObject into a different object\n     * \n     * @param anObject\n     *            the object to be transformed\n     * @return the transformed object\n     */\n    protected abstract Object primTransform(Object anObject) throws Exception;\n}\n","sourceCodeStart":12,"sourceCodeEnd":43,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/transformer/AbstractTransformer.java#L12-L43","documentation":"FlowableException thrown by AbstractTransformer.transform when the concrete primTransform implementation throws any exception. It wraps the original cause in a message identifying the object and the transformer, converting arbitrary transformer failures into Flowable's runtime exception type.","triggerScenarios":"Any registered variable transformer (e.g. date/serializable transformers) whose primTransform fails: unparseable input format, ClassCastException, IO/serialization errors during variable conversion when setting or getting variables.","commonSituations":"Setting a process variable whose type does not match the expected transformer (e.g. malformed date string); deserialization failures after upgrading Flowable/JDK so stored serialized variables no longer match; custom transformer bugs.","solutions":["Inspect the wrapped cause (e.getCause() in logs) to find the real failure — usually a format, cast, or serialization problem.","Validate/normalize the value before passing it to the engine API (e.g. parse dates with a fixed formatter, pass correct types).","For serialization-related causes after an upgrade, check compatible JDK/Flowable versions and re-save the affected variables.","Fix or add unit tests for custom transformer implementations (primTransform) to handle edge inputs."],"exampleFix":"// before\ntaskService.setVariable(taskId, \"dueDate\", \"2026-13-45\");\n\n// after: validate before transform\nDate parsed = null;\ntry {\n    parsed = new SimpleDateFormat(\"yyyy-MM-dd\").parse(\"2026-05-01\");\n} catch (ParseException e) {\n    throw new IllegalArgumentException(\"invalid date\", e);\n}\ntaskService.setVariable(taskId, \"dueDate\", parsed);","handlingStrategy":"try-catch","validationCode":"if (value instanceof String && expectsDate) {\n    new SimpleDateFormat(\"yyyy-MM-dd\").parse((String) value); // fails fast with clear error\n}","typeGuard":null,"tryCatchPattern":"try {\n    taskService.setVariable(taskId, name, value);\n} catch (FlowableException e) {\n    log.error(\"transform failed for '{}': {}\", name, e.getCause(), e);\n    throw e;\n}","preventionTips":["Always inspect the cause chain — this exception is only a wrapper","Pass correctly typed values to setVariable (Date, Boolean, etc.)","Unit-test custom transformers with null, empty, and malformed inputs","Check JDK/Flowable compatibility when serialization errors appear after upgrade"],"tags":["flowable","transformer","variable-conversion"],"backgroundTag":"invalid-argument-value","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}