{"record":{"id":"f4dda73e892c0a2b","repo":"flowable/flowable-engine","slug":"exc-getmessage-f4dda7","errorCode":null,"errorMessage":"${exc.getMessage()}","messagePattern":"\\$\\{exc\\.getMessage\\(\\)\\}","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/ServiceTaskExpressionActivityBehavior.java","lineNumber":106,"sourceCode":"            Throwable cause = exc;\n            BpmnError error = null;\n            while (cause != null) {\n                if (cause instanceof BpmnError) {\n                    error = (BpmnError) cause;\n                    break;\n\n                } else if (cause instanceof RuntimeException) {\n                    if (ErrorPropagation.mapException((RuntimeException) cause, activityExecution, mapExceptions)) {\n                        return;\n                    }\n                }\n                cause = cause.getCause();\n            }\n\n            if (error != null) {\n                ErrorPropagation.propagateError(error, activityExecution);\n            } else {\n                throw new ActivitiException(exc.getMessage(), exc);\n            }\n        }\n    }\n}\n","sourceCodeStart":88,"sourceCodeEnd":111,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/ServiceTaskExpressionActivityBehavior.java#L88-L111","documentation":"In ServiceTaskExpressionActivityBehavior.execute, when the expression-invoked method throws a non-BpmnError exception, the engine propagates the error if a BpmnError is found in the cause chain, otherwise re-throws as ActivitiException with the original exception's message and cause. It signals the flowable:expression call failed at runtime.","triggerScenarios":"flowable:expression=\"${bean.method(exec)}\" where the invoked method throws (NPE, IllegalArgumentException, IO failure) and no BpmnError exists anywhere in the cause chain.","commonSituations":"Expression calls a Spring bean method that dereferences a missing process variable; the bean throws a checked exception wrapped in RuntimeException; the method signature changed and evaluation fails; message is null in logs because the original exception had no message.","solutions":["Fix the exception in the bean method invoked by the expression — inspect the 'Caused by' chain","Guard against missing/null process variables inside the bean before using them","Throw BpmnError from the bean for business errors so error boundary events can catch them","Return/validate early: check inputs in the bean method and fail with a clear message"],"exampleFix":"// before\npublic void handle(DelegateExecution e) {\n    process((Order) e.getVariable(\"order\")); // NPE when 'order' unset\n}\n// after\npublic void handle(DelegateExecution e) {\n    Order order = (Order) e.getVariable(\"order\");\n    if (order == null) {\n        throw new BpmnError(\"NO_ORDER\", \"process variable 'order' is required\");\n    }\n    process(order);\n}","handlingStrategy":"try-catch","validationCode":"Object order = execution.getVariable(\"order\");\nif (!(order instanceof Order)) {\n    throw new BpmnError(\"NO_ORDER\");\n}","typeGuard":"public static boolean hasVariable(DelegateExecution e, String name, Class<?> type) {\n    return type.isInstance(e.getVariable(name));\n}","tryCatchPattern":"try {\n    taskService.complete(taskId);\n} catch (org.activiti.engine.ActivitiException e) {\n    if (e.getMessage() == null) {\n        log.error(\"expression failed, cause chain:\", e); // message mirrors cause's message\n    }\n    throw e;\n}","preventionTips":["Guard bean methods invoked via flowable:expression against null/missing variables","Always pass DelegateExecution explicitly in expression method signatures and read variables safely","Throw BpmnError for business errors to enable error boundary event handling","Keep exception messages non-null and descriptive since the engine copies them"],"tags":["bpmn","service-task","expression","wrapped-exception"],"backgroundTag":"upstream-api-error","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"}