{"record":{"id":"b1acb5c16852cc8a","repo":"flowable/flowable-engine","slug":"job-jobid-failed-b1acb5","errorCode":null,"errorMessage":"Job ${jobId} failed","messagePattern":"Job (.+?) failed","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/ExecuteJobsCmd.java","lineNumber":111,"sourceCode":"            }\n\n        } catch (Throwable exception) {\n            failedJobListener.setException(exception);\n\n            // Dispatch an event, indicating job execution failed in a try-catch block, to prevent the original\n            // exception to be swallowed\n            if (commandContext.getEventDispatcher().isEnabled()) {\n                try {\n                    commandContext.getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityExceptionEvent(\n                            FlowableEngineEventType.JOB_EXECUTION_FAILURE, job, exception), EngineConfigurationConstants.KEY_PROCESS_ENGINE_CONFIG);\n                } catch (Throwable ignore) {\n                    LOGGER.warn(\"Exception occurred while dispatching job failure event, ignoring.\", ignore);\n                }\n            }\n\n            // Finally, Throw the exception to indicate the ExecuteJobCmd failed\n            if (!(exception instanceof ActivitiException)) {\n                throw new ActivitiException(\"Job \" + jobId + \" failed\", exception);\n            } else {\n                throw (ActivitiException) exception;\n            }\n        } finally {\n            if (jobExecutorContext != null) {\n                jobExecutorContext.setCurrentJob(null);\n            }\n        }\n        return null;\n    }\n\n    public String getJobId() {\n        return jobId;\n    }\n\n}\n","sourceCodeStart":93,"sourceCodeEnd":128,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/ExecuteJobsCmd.java#L93-L128","documentation":"When job execution throws, ExecuteJobsCmd dispatches a job-failure event and then rethrows. If the original exception is not already an ActivitiException it is wrapped in one with the message \"Job <jobId> failed\" and the cause attached, to signal that the job execution itself failed.","triggerScenarios":"Any exception thrown while executing an async job — e.g. a BPMN error, classpath failure in a service task delegate, database failure during job execution, or a NullPointerException inside a delegate expression.","commonSituations":"Service-task delegate classes throwing unexpected exceptions; missing delegate bean/expression; OQL/DB connectivity errors during job processing; job retry exhaustion surfacing the last failure.","solutions":["Inspect the exception's cause for the real failure in the job/delegate","Fix the underlying error in the job's delegate or command logic","Check job retry counters and reset retries to re-run the job","Enable job-executor logging to capture the full stack trace at failure time"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { managementService.executeJob(jobId); } catch (ActivitiException e) { Throwable cause = e.getCause(); LOGGER.error(\"Job failed: {}\", cause, cause); }","preventionTips":["Always inspect getCause() — the real error lives there","Add logging/monitoring on job execution failures","Fix delegates to throw meaningful exceptions instead of NPEs","Manage job retry counts to avoid silent retry exhaustion"],"tags":["job-executor","job-failure","wrapped-exception"],"backgroundTag":"job-execution-failed","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"}