flowable/flowable-engine · error · ActivitiException

Job ${jobId} failed

Error message

Job ${jobId} failed

What it means

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.

Source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/ExecuteJobsCmd.java:111

            }

        } catch (Throwable exception) {
            failedJobListener.setException(exception);

            // Dispatch an event, indicating job execution failed in a try-catch block, to prevent the original
            // exception to be swallowed
            if (commandContext.getEventDispatcher().isEnabled()) {
                try {
                    commandContext.getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityExceptionEvent(
                            FlowableEngineEventType.JOB_EXECUTION_FAILURE, job, exception), EngineConfigurationConstants.KEY_PROCESS_ENGINE_CONFIG);
                } catch (Throwable ignore) {
                    LOGGER.warn("Exception occurred while dispatching job failure event, ignoring.", ignore);
                }
            }

            // Finally, Throw the exception to indicate the ExecuteJobCmd failed
            if (!(exception instanceof ActivitiException)) {
                throw new ActivitiException("Job " + jobId + " failed", exception);
            } else {
                throw (ActivitiException) exception;
            }
        } finally {
            if (jobExecutorContext != null) {
                jobExecutorContext.setCurrentJob(null);
            }
        }
        return null;
    }

    public String getJobId() {
        return jobId;
    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Inspect the exception's cause for the real failure in the job/delegate
  2. Fix the underlying error in the job's delegate or command logic
  3. Check job retry counters and reset retries to re-run the job
  4. Enable job-executor logging to capture the full stack trace at failure time
Defensive patterns

Strategy: try-catch

Try / catch

try { managementService.executeJob(jobId); } catch (ActivitiException e) { Throwable cause = e.getCause(); LOGGER.error("Job failed: {}", cause, cause); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/b1acb5c16852cc8a. Report an issue: GitHub.