conductor-oss/conductor · error · ConflictException

Workflow: %s is not in terminal state, unable to rerun.

Error message

Workflow: %s is not in terminal state, unable to rerun.

What it means

Thrown by rerunWF() when the caller invokes the rerun/retry API on a workflow whose status is not terminal (i.e., not COMPLETED, FAILED, TERMINATED, or TIMED_OUT). Conductor only allows rerun on workflows that have finished their lifecycle; rerunning an active RUNNING or PAUSED workflow would corrupt in-flight task state. The message embeds the full WorkflowModel.toString() so you can see the current status inline.

Source

Thrown at core/src/main/java/com/netflix/conductor/core/execution/WorkflowExecutorOps.java:2186

                failureWorkflow,
                failureWorkflowVersion);
    }

    private boolean rerunWF(
            String workflowId,
            String taskId,
            Map<String, Object> taskInput,
            Map<String, Object> workflowInput,
            String correlationId) {

        // Get the workflow
        WorkflowModel workflow = executionDAOFacade.getWorkflowModel(workflowId, true);
        if (!workflow.getStatus().isTerminal()) {
            String errorMsg =
                    String.format(
                            "Workflow: %s is not in terminal state, unable to rerun.", workflow);
            LOGGER.error(errorMsg);
            throw new ConflictException(errorMsg);
        }
        // If the task Id is null it implies that the entire workflow has to be rerun
        if (taskId == null) {
            // remove all tasks
            workflow.getTasks().forEach(task -> executionDAOFacade.removeTask(task.getTaskId()));
            workflow.setTasks(new ArrayList<>());
            // Set workflow as RUNNING
            workflow.setStatus(WorkflowModel.Status.RUNNING);
            // Reset failure reason from previous run to default
            workflow.setReasonForIncompletion(null);
            workflow.setFailedTaskId(null);
            workflow.setFailedReferenceTaskNames(new HashSet<>());
            workflow.setFailedTaskNames(new HashSet<>());

            if (correlationId != null) {
                workflow.setCorrelationId(correlationId);
            }
            if (workflowInput != null) {

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Check the workflow status via GET /api/workflow/{workflowId} and wait until it reaches a terminal status (COMPLETED, FAILED, TERMINATED, TIMED_OUT) before calling rerun.
  2. If the workflow is stuck in RUNNING and you need to force-rerun, first terminate it via POST /api/workflow/{workflowId}/terminate, then rerun.
  3. If the workflow is PAUSED, resume it (PUT /api/workflow/{workflowId}/resume) or terminate it before rerunning.
  4. For sub-workflow reruns, ensure the parent workflow and all children are terminal before initiating a recursive rerun.

Example fix

// before
workflowExecutor.rerun(workflowId, null, null, null, null);

// after
WorkflowModel wf = executionDAOFacade.getWorkflowModel(workflowId, false);
if (!wf.getStatus().isTerminal()) {
    throw new IllegalStateException("Cannot rerun: workflow is " + wf.getStatus());
}
workflowExecutor.rerun(workflowId, null, null, null, null);
Defensive patterns

Strategy: validation

Validate before calling

// Before calling rerun, check terminal status
WorkflowModel wf = executionDAOFacade.getWorkflowModel(workflowId, false);
if (!wf.getStatus().isTerminal()) {
    throw new IllegalStateException(
        "Cannot rerun workflow " + workflowId + " in status " + wf.getStatus());
}
workflowExecutor.rerun(workflowId, null, null, null, null);

Prevention

When it happens

Trigger: Calling WorkflowExecutor.rerun() (REST: PUT /api/workflow/{workflowId}/rerun or retry) while the workflow is in RUNNING, PAUSED, or any non-terminal status. Also triggered when a parent workflow initiates a recursive rerunWF on a sub-workflow that is still executing.

Common situations: Polling a workflow that is still executing and calling rerun prematurely. A UI 'Retry' button that does not check status first. Race conditions where the decider has not yet marked a failed workflow as terminal before the rerun call arrives.

Related errors


AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14). Data as JSON: /api/errors/66633df6a579ff3a. Report an issue: GitHub.