flowable/flowable-engine · error · ActivitiException

Job {} failed

Error message

Job {} failed

What it means

This is the generic wrapper ActivitiException thrown by ExecuteJobsCmd when asynchronous job execution fails with a non-Activiti exception. The original exception (whatever the job handler, delegate, or listener threw) is attached as the cause, and a JOB_EXECUTION_FAILURE event is dispatched to the event registry first. If the underlying failure was already an ActivitiException it is rethrown as-is; otherwise it is wrapped with the message 'Job <id> failed'.

Source

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

            if (commandContext.getEventDispatcher().isEnabled()) {
                commandContext.getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(
                        FlowableEngineEventType.JOB_EXECUTION_SUCCESS, job), EngineConfigurationConstants.KEY_PROCESS_ENGINE_CONFIG);
            }

        } 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 'cause' of this exception — it contains the real failure from the job/delegate — and fix that root issue.
  2. Review the ACT_GE_JOB / dead-letter job tables (or management service job queries) for the failed job, its exception stack trace and retry count.
  3. Fix the delegate/handler code that threw, or handle business exceptions inside the delegate.
  4. Redeploy/retry the job (JobRetriesServiceImpl or managementService retries) once the root cause is fixed; check job executor logs for repeated failures.

Example fix

// before
class MyDelegate implements JavaDelegate {
  public void execute(DelegateExecution e) {
    throw new RuntimeException("config missing");
  }
}
// after
class MyDelegate implements JavaDelegate {
  public void execute(DelegateExecution e) {
    String cfg = (String) e.getVariable("config");
    if (cfg == null) {
      throw new BpmnError("MISSING_CONFIG", "config variable missing");
    }
  }
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  managementService.executeJob(jobId);
} catch (ActivitiException e) {
  Throwable root = e.getCause();
  log.error("Job {} failed, root cause: {}", jobId, root, root);
  if (root instanceof BpmnError) {
    // route to error handling / compensation
  } else {
    // inspect failed job retries via managementService.createJobQuery()
  }
}

Prevention

When it happens

Trigger: Any async job (timer, async continuation, message job) whose execution throws a checked/unexpected Throwable: a delegate class throwing a RuntimeException, a job handler misconfiguration, a classpath/serialization failure, or a database error during job execution. Raised in ExecuteJobsCmd.execute.

Common situations: JavaDelegate throwing NPEs or business exceptions; missing delegate class on the server classpath; job handler configuration referencing an unknown handler type; transient DB failures (lock contention, connection loss) during async execution; failed retries after max attempts in a job executor environment.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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