apache/dolphinscheduler · error · IllegalStateException
"The workflow " + workflowExecution.getName() + "is success,
Error message
"The workflow " + workflowExecution.getName() + "is success, shouldn't emit workflow finished event"
What it means
WorkflowFailoverStateAction also forbids emitting a workflow finished event (message text says 'is success' but the class is failover): a failover-state workflow must transition rather than emit a terminal finished event. Thrown when a finish event reaches this handler.
Source
Thrown at dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/statemachine/WorkflowFailoverStateAction.java:117
@Override
public void onFinalizeEvent(final IWorkflowExecution workflowExecution,
final WorkflowFinalizeLifecycleEvent workflowFinalizeEvent) {
throwExceptionIfStateIsNotMatch(workflowExecution);
logWarningIfCannotDoAction(workflowExecution, workflowFinalizeEvent);
}
@Override
public WorkflowExecutionStatus matchState() {
return WorkflowExecutionStatus.FAILOVER;
}
/**
* The running state can only finish with success/failure.
*/
@Override
protected void emitWorkflowFinishedEventIfApplicable(IWorkflowExecution workflowExecution) {
throw new IllegalStateException(
"The workflow " + workflowExecution.getName() +
"is success, shouldn't emit workflow finished event");
}
}
View on GitHub (pinned to 02eac45a1b)
Solutions
- Confirm the workflow instance's state at the time of the event (DB check)
- Filter/de-duplicate finish events after failover recovery
- Ensure failover completes state transition before processing further events
- Upgrade to a release with failover event idempotency fixes
Example fix
// before
stateAction.emitWorkflowFinishedEventIfApplicable(execution); // throws in FAILOVER
// after
if (execution.getState() == WorkflowExecutionStatus.RUNNING_EXECUTION) {
stateAction.emitWorkflowFinishedEventIfApplicable(execution);
} Defensive patterns
Strategy: validation
Validate before calling
if (workflowExecution.getState() == WorkflowExecutionStatus.FAILOVER) { log.warn("finish event during failover, ignore"); return; } Type guard
boolean canEmitFinished(IWorkflowExecution w) { return w.getState() != WorkflowExecutionStatus.FAILOVER; } Try / catch
try { emitFinished(workflowExecution); } catch (IllegalStateException e) { log.warn("event rejected in failover state: {}", e.getMessage()); } Prevention
- Complete failover transitions before processing further events
- Suppress finish events recorded before failover began
- Keep failover event replay logic idempotent
When it happens
Trigger: emitWorkflowFinishedEventIfApplicable invoked on a workflow execution in FAILOVER state — a routed WorkflowFinishedEvent that should instead have triggered failover logic.
Common situations: Stale finish events surviving a master failover, event replay, incorrect state-action lookup during the failover window.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- "The workflow: " + workflowName + " state: " + actualState +
- "The workflow " + workflowExecution.getName() + "is failed,
- 50004
- "The task: " + taskExecution.getName() + " state: " + taskIn
- "Cannot find TaskStateAction for state: " + taskExecutionSta
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/a738b796f6d4069a.
Report an issue: GitHub.