{"record":{"id":"843a0a8e976854fa","repo":"flowable/flowable-engine","slug":"error-while-executing-transformation-from-object-843a0a","errorCode":null,"errorMessage":"Error while executing transformation from object: ${anObject} using transformer ${this}","messagePattern":"Error while executing transformation from object: (.+?) using transformer (.+?)","errorType":"exception","errorClass":"org.activiti.engine.ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/transformer/AbstractTransformer.java","lineNumber":30,"sourceCode":" */\npackage org.activiti.engine.impl.transformer;\n\nimport org.activiti.engine.ActivitiException;\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 ActivitiException(\"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/flowable5-engine/src/main/java/org/activiti/engine/impl/transformer/AbstractTransformer.java#L12-L43","documentation":"AbstractTransformer.transform wraps the subclass-provided primTransform in try/catch and rethrows any exception as an ActivitiException that includes the input object and the transformer's toString. It is a uniform error envelope for the transformation pipeline.","triggerScenarios":"Any primTransform implementation throwing (e.g. incompatible input object type, parse failure, misconfigured transformer), which transform() converts into this message.","commonSituations":"Feeding an object of the wrong type into a transformer chain; transformers written for a legacy input format; NPEs inside custom primTransform implementations.","solutions":["Inspect the chained cause (e.getCause()) for the real failure inside primTransform.","Verify the input object type matches what the transformer's primTransform expects.","Add pre-validation or type dispatch before calling transform()."],"exampleFix":"// before\nObject result = transformer.transform(rawObject);\n// after\nif (rawObject instanceof ExpectedType) {\n    Object result = transformer.transform(rawObject);\n} else {\n    throw new IllegalArgumentException(\"transformer expects ExpectedType, got \" + rawObject.getClass());\n}","handlingStrategy":"try-catch","validationCode":"if (input == null || !ExpectedType.class.isInstance(input)) {\n    throw new IllegalArgumentException(\"Transformer input type mismatch: \" + (input == null ? \"null\" : input.getClass().getName()));\n}","typeGuard":null,"tryCatchPattern":"try {\n    result = transformer.transform(obj);\n} catch (ActivitiException e) {\n    Throwable root = e;\n    while (root.getCause() != null) root = root.getCause(); // real error is inside primTransform\n    log.error(\"transform failed for {}\", obj, root);\n}","preventionTips":["Always inspect the chained cause — the message names only the input object and transformer","Validate input type/shape before calling transform()","Implement primTransform defensively: null checks and type checks first","Add unit tests for each transformer's expected input types"],"tags":["transformation","wrapper-exception"],"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-18T11:17:12.947Z"}