{"record":{"id":"af7ad035a7a8e100","repo":"flowable/flowable-engine","slug":"exception-occurred-while-dispatching-job-failure-e","errorCode":null,"errorMessage":"Exception occurred while dispatching job failure event, ignoring.","messagePattern":"Exception occurred while dispatching job failure event, ignoring\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/DefaultAsyncRunnableExecutionExceptionHandler.java","lineNumber":69,"sourceCode":"                    }\n                }\n\n                CommandConfig commandConfig = jobServiceConfiguration.getCommandExecutor().getDefaultConfig().transactionRequiresNew();\n                FailedJobCommandFactory failedJobCommandFactory = jobServiceConfiguration.getFailedJobCommandFactory();\n                Command<Object> cmd = failedJobCommandFactory.getCommand(job.getId(), exception);\n\n                LOGGER.trace(\"Using FailedJobCommandFactory '{}' and command of type '{}'\", failedJobCommandFactory.getClass(), cmd.getClass());\n                jobServiceConfiguration.getCommandExecutor().execute(commandConfig, cmd);\n\n                // Dispatch an event, indicating job execution failed in a\n                // try-catch block, to prevent the original exception to be swallowed\n                FlowableEventDispatcher eventDispatcher = jobServiceConfiguration.getEventDispatcher();\n                if (eventDispatcher != null && eventDispatcher.isEnabled()) {\n                    try {\n                        eventDispatcher.dispatchEvent(FlowableJobEventBuilder.createEntityExceptionEvent(\n                                FlowableEngineEventType.JOB_EXECUTION_FAILURE, job, exception), jobServiceConfiguration.getEngineName());\n                    } catch (Throwable ignore) {\n                        LOGGER.warn(\"Exception occurred while dispatching job failure event, ignoring.\", ignore);\n                    }\n                }\n\n                return null;\n            }\n\n        });\n\n        return true;\n    }\n\n\n}\n","sourceCodeStart":51,"sourceCodeEnd":83,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/asyncexecutor/DefaultAsyncRunnableExecutionExceptionHandler.java#L51-L83","documentation":"WARN log from DefaultAsyncRunnableExecutionExceptionHandler: after a job fails execution, Flowable tries to dispatch a JOB_EXECUTION_FAILURE event to the event dispatcher; if that dispatch itself throws, it is logged and swallowed so the original job-failure handling is not disrupted. Your job failed AND the failure-event listeners blew up.","triggerScenarios":"A registered event listener for JOB_EXECUTION_FAILURE throws during handleEvent; event dispatcher enabled but a listener misbehaves (NPE, remote call failure, transaction issues).","commonSituations":"Custom event listeners doing I/O (HTTP, messaging) that fail; listeners assuming transactional context that isn't present; third-party integrations (Camunda-style audit listeners) incompatible with the event payload.","solutions":["Inspect the chained 'ignore' exception to find which event listener threw","Fix or wrap the failing listener so it handles its own errors","Temporarily remove the listener to confirm it is the culprit","If listeners must do I/O, add their own retry/circuit-breaker inside the listener"],"exampleFix":"// before\npublic void onEvent(FlowableEvent event) { notifyMonitoringRemote(event); } // throws on network error\n// after\npublic void onEvent(FlowableEvent event) {\n    try { notifyMonitoringRemote(event); } catch (Exception e) { LOG.warn(\"monitoring notify failed\", e); }\n}","handlingStrategy":"try-catch","validationCode":"// validate listeners at startup\nengineConfig.getEventListeners().forEach(l -> {\n    if (!(l instanceof FlowableEventListener)) throw new IllegalStateException(\"bad listener registration\");\n});","typeGuard":null,"tryCatchPattern":"try {\n    eventDispatcher.dispatchEvent(failureEvent, engineName);\n} catch (Throwable ignore) {\n    LOGGER.warn(\"Exception occurred while dispatching job failure event, ignoring.\", ignore);\n}","preventionTips":["Make every custom event listener swallow-and-log its own exceptions","Avoid blocking I/O inside event listeners","Test listeners against JOB_EXECUTION_FAILURE events"],"tags":["flowable","event-dispatch","job-execution-failure","listener","async-executor"],"backgroundTag":"http-request-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"}