conductor-oss/conductor · error · ConflictException

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

Error message

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

What it means

restart requires the workflow to already be in a terminal state; if it is still running (RUNNING, PAUSED, etc.) the engine throws a ConflictException. Restart resets and re-creates the workflow, which is only safe on a finished workflow.

Source

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

    /**
     * @param workflowId the id of the workflow to be restarted
     * @param useLatestDefinitions if true, use the latest workflow and task definitions upon
     *     restart
     * @throws ConflictException Workflow is not in a terminal state.
     * @throws NotFoundException Workflow definition is not found or Workflow is deemed
     *     non-restartable as per workflow definition.
     */
    @Override
    public void restart(String workflowId, boolean useLatestDefinitions) {
        final WorkflowModel workflow = executionDAOFacade.getWorkflowModel(workflowId, true);

        if (!workflow.getStatus().isTerminal()) {
            String errorMsg =
                    String.format(
                            "Workflow: %s is not in terminal state, unable to restart.", workflow);
            LOGGER.error(errorMsg);
            throw new ConflictException(errorMsg);
        }

        WorkflowDef workflowDef;
        if (useLatestDefinitions) {
            workflowDef =
                    metadataDAO
                            .getLatestWorkflowDef(workflow.getWorkflowName())
                            .orElseThrow(
                                    () ->
                                            new NotFoundException(
                                                    "Unable to find latest definition for %s",
                                                    workflowId));
            workflow.setWorkflowDefinition(workflowDef);
            workflowDef = metadataMapperService.populateTaskDefinitions(workflowDef);
        } else {
            workflowDef =
                    Optional.ofNullable(workflow.getWorkflowDefinition())
                            .orElseGet(

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Wait for the workflow to reach a terminal status (or terminate it) before calling restart.
  2. Check workflow.getStatus().isTerminal() and surface a clear message if not.
  3. Use pause + terminate if you need to force a running workflow into a restartable state.

Example fix

// before
workflowExecutor.restart(workflowId, false);

// after
WorkflowModel wf = executionDAOFacade.getWorkflowModel(workflowId, true);
if (wf.getStatus().isTerminal()) {
    workflowExecutor.restart(workflowId, false);
} else {
    // terminate first, or wait
}
Defensive patterns

Strategy: validation

Validate before calling

WorkflowModel wf = executionDAOFacade.getWorkflowModel(workflowId, true);
if (!wf.getStatus().isTerminal()) {
    // wait, or terminate first
    throw new IllegalStateException("workflow not terminal: " + wf.getStatus());
}
workflowExecutor.restart(workflowId, useLatestDefinitions);

Try / catch

try {
    workflowExecutor.restart(workflowId, useLatestDefinitions);
} catch (ConflictException e) {
    // workflow still running; wait or terminate first
}

Prevention

When it happens

Trigger: Calling WorkflowExecutor.restart on a workflow whose status is not terminal (e.g. RUNNING, PAUSED).

Common situations: Automation that restarts on failure without checking status; race where the workflow is still draining; UI allowing restart on a paused workflow.

Related errors


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