apache/dolphinscheduler · error · IllegalStateException

Workflow definition not found: <workflowCode> version <workf

Error message

Workflow definition not found: <workflowCode> version <workflowVersion>

What it means

Thrown in AbstractWorkflowTrigger.getProcessDefinition when workflowDefinitionDao.queryByDefinitionCodeAndVersion(workflowCode, workflowVersion) returns null during a workflow trigger: the master cannot load the exact code+version of the workflow definition it was asked to run — the definition was deleted, the version never existed, or metadata is inconsistent, so triggering cannot proceed.

Source

Thrown at dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/trigger/AbstractWorkflowTrigger.java:94

        }

        return onTriggerSuccess(workflowInstance);
    }

    // todo: 使用WorkflowInstanceConstructor封装
    protected abstract ImmutablePair<WorkflowDefinition, WorkflowInstance> constructWorkflowInstance(final TriggerRequest triggerRequest);

    // todo: 使用CommandConstructor封装
    protected abstract Command constructTriggerCommand(final TriggerRequest triggerRequest,
                                                       final WorkflowInstance workflowInstance);

    protected abstract TriggerResponse onTriggerSuccess(final WorkflowInstance workflowInstance);

    protected WorkflowDefinition getProcessDefinition(final Long workflowCode, final Integer workflowVersion) {
        final WorkflowDefinitionLog workflow = workflowDefinitionDao.queryByDefinitionCodeAndVersion(
                workflowCode, workflowVersion);
        if (workflow == null) {
            throw new IllegalStateException(
                    "Workflow definition not found: " + workflowCode + " version " + workflowVersion);
        }
        return workflow;
    }

    protected User getExecutorUser(final Integer userId) {
        return userDao.queryOptionalById(userId)
                .orElseThrow(() -> new IllegalStateException("User not found: " + userId));
    }

}

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Verify the workflow with that code/version still exists and is not deleted in the UI
  2. If a schedule or retry references a stale version, update it to a valid published version
  3. Check t_ds_workflow_definition_log for the code/version pair to confirm what the master expected
  4. Re-trigger the workflow after restoring a valid definition version
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/trigger/AbstractWorkflowTrigger.java:94 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/832d303275670204. Report an issue: GitHub.