apache/dolphinscheduler · error · ServiceException
COPY_WORKFLOW_DEFINITION_ERROR
COPY_WORKFLOW_DEFINITION_ERROR
Error message
COPY_WORKFLOW_DEFINITION_ERROR: copy workflow definition from project {0} to project {1} error, failed workflows: {2} What it means
Thrown by checkBatchOperateResult at the end of a batch COPY of workflow definitions when at least one workflow failed to copy. failedWorkflowList collects per-workflow failures (e.g. from createDagDefine errors or task params parse failures), and this error reports the source project, target project, and the comma-separated 'code[name]' list of failed workflows. The batch is best-effort: other workflows may have been copied.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:1672
/**
* check batch operate result
*
* @param srcProjectCode srcProjectCode
* @param targetProjectCode targetProjectCode
* @param result result
* @param failedWorkflowList failedWorkflowList
* @param isCopy isCopy
*/
private void checkBatchOperateResult(long srcProjectCode, long targetProjectCode,
List<String> failedWorkflowList, boolean isCopy) {
if (!failedWorkflowList.isEmpty()) {
String failedWorkflow = String.join(",", failedWorkflowList);
if (isCopy) {
log.error(
"Copy workflow definition error, srcProjectCode:{}, targetProjectCode:{}, failedWorkflowList:{}.",
srcProjectCode, targetProjectCode, failedWorkflow);
throw new ServiceException(Status.COPY_WORKFLOW_DEFINITION_ERROR, srcProjectCode, targetProjectCode,
failedWorkflow);
}
log.error(
"Move workflow definition error, srcProjectCode:{}, targetProjectCode:{}, failedWorkflowList:{}.",
srcProjectCode, targetProjectCode, failedWorkflow);
throw new ServiceException(Status.MOVE_WORKFLOW_DEFINITION_ERROR, srcProjectCode, targetProjectCode,
failedWorkflow);
}
log.info("Batch {} workflow definition complete, srcProjectCode:{}, targetProjectCode:{}.",
isCopy ? "copy" : "move", srcProjectCode, targetProjectCode);
}
/**
* query the pagination versions info by one certain workflow definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code
* @param pageNo page numberView on GitHub (pinned to 02eac45a1b)
Solutions
- Read the failed workflows list in the message and retry copying only those workflows after fixing each cause.
- Inspect API server logs for the per-workflow exception logged during the copy loop (e.g. 'Copy workflow definition error, workflowDefinitionCode from ... to ...').
- Fix invalid task definitions (Switch/Condition taskParams, missing task codes) in the source workflow, then re-run the copy.
- Verify you have write permission on the target project and that its metadata rows are healthy before re-copying.
Example fix
// before: batch copy includes a corrupt workflow -> whole call errors
POST /projects/{code}/workflow-definition/copy codes=111,222(bad),333
// after: exclude known-bad codes, fix 222, copy separately
codes=111,333 -> success; then repair wf 222's Switch taskParams and copy it alone Defensive patterns
Strategy: validation
Validate before calling
// Validate each source workflow's task params before batch copy
boolean allTasksValid(WorkflowDefinition wf) {
return taskDefinitionMapper.queryByWorkflowDefinitionCode(wf.getCode()).stream()
.allMatch(t -> t.getTaskParams() != null && !t.getTaskParams().trim().isEmpty());
} Try / catch
try {
workflowDefinitionService.batchCopyWorkflowDefinition(user, srcProjectCode, targetProjectCode, codes, true);
} catch (ServiceException e) {
// message lists failed "code[name]" workflows; fix those and re-copy individually
} Prevention
- Validate task_params of all tasks in the source workflows before batch copying.
- Copy workflows in small batches so one bad definition doesn't fail a large aggregate.
- Check the API server logs for the per-workflow 'Copy workflow definition error' entries.
- Ensure the target project exists and you hold write permission on it.
When it happens
Trigger: Calling the copy-workflows endpoint (isCopy=true) where any workflow failed during the inner copy loop — e.g. DAG creation exceptions (invalid task relations, unmapped task codes), invalid Switch/Condition taskParams, or schedule/DB write failures.
Common situations: Copying workflows whose task params are corrupt or from a different version; target project permission/schema problems; name collisions or dangling task codes in the source DAG; copying many workflows where one bad definition aborts the aggregate result.
Related errors
- {joined failure messages, e.g. Failed do action <executeType
- MOVE_WORKFLOW_DEFINITION_ERROR
- 10001
- The execType: {execType} is invalid
- The releaseState {releaseState} is illegal, please check it.
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/d2bdf82b597aae34.
Report an issue: GitHub.