apache/dolphinscheduler · error · ServiceException

DELETE_WORKFLOW_LINEAGE_ERROR

DELETE_WORKFLOW_LINEAGE_ERROR

Error message

DELETE_WORKFLOW_LINEAGE_ERROR: delete workflow lineage error

What it means

Thrown when workflowLineageService.deleteWorkflowLineage returns a negative value, signaling the lineage deletion for the workflow code failed at the persistence layer. A return of 0 is tolerated (no lineage existed) with only a warning.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:919

        // delete task definition
        taskDefinitionService.deleteTaskByWorkflowDefinitionCode(workflowDefinition.getCode(),
                workflowDefinition.getVersion());
        // delete task definition log
        taskDefinitionLogService.deleteTaskByWorkflowDefinitionCode(workflowDefinition.getCode());
        // delete workflow definition log
        workflowDefinitionLogDao.deleteByWorkflowDefinitionCode(workflowDefinition.getCode());

        // we delete the workflow definition at last to avoid using transaction here.
        // If delete error, we can call this interface again.
        workflowDefinitionDao.deleteByWorkflowDefinitionCode(workflowDefinition.getCode());

        // delete workflow lineage (lineage data only keeps one record per workflow code)
        // It's safe to return 0 if no lineage exists (idempotent)
        int deleteWorkflowLineageResult = workflowLineageService
                .deleteWorkflowLineage(Collections.singletonList(workflowDefinition.getCode()));
        if (deleteWorkflowLineageResult <= 0) {
            if (deleteWorkflowLineageResult < 0) {
                throw new ServiceException(Status.DELETE_WORKFLOW_LINEAGE_ERROR);
            } else {
                log.warn("No workflow lineage to delete, workflowDefinitionCode: {}", code);
            }
        }
        log.info("Success delete workflow definition workflowDefinitionCode: {}", code);
    }

    /**
     * check the workflow task relation json
     *
     * @param workflowTaskRelationJson workflow task relation json
     * @return check result code
     */
    @Override
    public void checkWorkflowNodeList(String workflowTaskRelationJson,
                                      List<TaskDefinitionLog> taskDefinitionLogsList) {
        try {
            if (workflowTaskRelationJson == null) {

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Inspect the service/DB logs for the underlying lineage delete failure and resolve the database issue.
  2. Retry the deletion after the DB recovers.
  3. Manually delete the orphaned lineage row for the workflow code, then verify the workflow record state.

Example fix

// before
int r = workflowLineageService.deleteWorkflowLineage(List.of(code));
if (r < 0) throw new ServiceException(Status.DELETE_WORKFLOW_LINEAGE_ERROR);
// after (retry with backoff)
int r = 0;
for (int i = 0; i < 3; i++) {
    r = workflowLineageService.deleteWorkflowLineage(List.of(code));
    if (r >= 0) break;
    Thread.sleep(1000L * (i + 1));
}
if (r < 0) throw new ServiceException(Status.DELETE_WORKFLOW_LINEAGE_ERROR);
Defensive patterns

Strategy: retry

Validate before calling

// ensure DB reachable and no open transaction holds the lineage row
boolean dbUp = dataSource.getConnection().isValid(3);

Try / catch

try { service.deleteWorkflowDefinitionByCode(user, code); }
catch (ServiceException e) { /* transient DB issue: retry with backoff, tolerate r==0 as no-op */ }

Prevention

When it happens

Trigger: The lineage table delete statement fails or reports an error for the workflow's code during deleteWorkflowDefinitionByCode — e.g. DB error, lock timeout, or lineage DAO returning -1 on exception.

Common situations: Metadata DB contention during bulk deletes; lineage table corruption or missing permissions; failed transactions leaving lineage rows locked.

Related errors


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