apache/dolphinscheduler · error · ServiceException
The workflow instance: %s status is %s, can not stop
Error message
The workflow instance: %s status is %s, can not stop
What it means
Thrown by StopWorkflowInstanceExecutorDelegate.exceptionIfWorkflowInstanceCannotStop when the instance's WorkflowExecutionStatus.isCanStop() is false. Only states that can be interrupted (e.g. RUNNING, READY_PAUSE variants) may be stopped; already-finished or already-stopping instances are rejected with this message.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/executor/workflow/StopWorkflowInstanceExecutorDelegate.java:70
@Override
public Void execute(StopWorkflowInstanceOperation workflowInstanceControlRequest) {
final WorkflowInstance workflowInstance = workflowInstanceControlRequest.workflowInstance;
exceptionIfWorkflowInstanceCannotStop(workflowInstance);
if (workflowInstance.getState().isCanDirectStopInDB()) {
directStopInDB(workflowInstance);
} else {
stopInMaster(workflowInstance);
}
return null;
}
void exceptionIfWorkflowInstanceCannotStop(WorkflowInstance workflowInstance) {
final WorkflowExecutionStatus workflowInstanceState = workflowInstance.getState();
if (workflowInstanceState.isCanStop()) {
return;
}
throw new ServiceException(
"The workflow instance: " + workflowInstance.getName() + " status is " + workflowInstanceState
+ ", can not stop");
}
void directStopInDB(WorkflowInstance workflowInstance) {
// todo: move the stop logic to master
transactionTemplate.execute(status -> {
workflowInstanceDao.updateWorkflowInstanceState(
workflowInstance.getId(),
workflowInstance.getState(),
WorkflowExecutionStatus.STOP);
serialCommandDao.deleteByWorkflowInstanceId(workflowInstance.getId());
return null;
});
log.info("Update workflow instance {} state from: {} to {} success",
workflowInstance.getName(),
workflowInstance.getState().name(),
WorkflowExecutionStatus.STOP.name());View on GitHub (pinned to 02eac45a1b)
Solutions
- Refresh the instance status; if it already reached a final state no stop is needed
- Use 'pause' instead of 'stop' for states that support pausing but not stopping
- Wait for READY_STOP to resolve to a final state before issuing further commands
- If the instance is stuck in a non-final state, clean it up manually in the DB and restart the master
Example fix
// before
stopDelegate.execute(stopOperation);
// after
if (instance.getState() != null && instance.getState().isFinalState()) {
return; // already finished, stop not needed
}
stopDelegate.execute(stopOperation); Defensive patterns
Strategy: validation
Validate before calling
WorkflowExecutionStatus st = instance.getState();
if (st == null || !st.isCanStop()) {
throw new IllegalStateException("Instance cannot be stopped in state " + st);
} Try / catch
try {
delegate.execute(op);
} catch (ServiceException e) {
log.warn("Stop rejected: {}", e.getMessage());
// refresh state; skip stop if already final
} Prevention
- Call isCanStop() before issuing stop
- Refresh instance status before stop actions
- Use pause for pausable states instead of stop
- Disable stop buttons in UI for final-state instances
When it happens
Trigger: Calling stop on a workflow instance in a non-stoppable state: already SUCCESS/FAILURE/STOP (final states), null state, or a state like READY_PAUSE where stop is not permitted.
Common situations: Clicking 'stop' twice so the second click hits an already-stopped instance; stopping an instance that already finished between list refresh and click; stopping a paused instance; stale UI showing running when the instance completed.
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 instance: %s status is %s, cannot repeat runnin
- WorkflowInstance: %s stop failed: %s
- Recover workflow instance failed: %s
- Repeat running workflow instance failed: %s
- WorkflowInstance: %s stop failed
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/2d6b8844072fdd6a.
Report an issue: GitHub.