apache/dolphinscheduler · warning · ServiceException
WORKFLOW_DEFINITION_CODES_IS_EMPTY
WORKFLOW_DEFINITION_CODES_IS_EMPTY
Error message
WORKFLOW_DEFINITION_CODES_IS_EMPTY: workflow definition codes is empty
What it means
Thrown by the workflow move/copy endpoints (moveWorkflowDefinition/copyWorkflowTo) when the required workflowDefinitionCodes parameter is an empty string. Moving or copying requires at least one workflow code to operate on.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:1323
checkBatchOperateResult(projectCode, targetProjectCode, failedWorkflowList, false);
}
private void checkParams(User loginUser,
long projectCode,
String workflowDefinitionCodes,
long targetProjectCode,
String perm,
boolean requireSourceWritePermission) {
Project project = projectDao.queryByCode(projectCode);
if (requireSourceWritePermission) {
projectService.checkHasProjectWritePermissionThrowException(loginUser, project);
} else {
projectService.checkProjectAndAuthThrowException(loginUser, project, perm);
}
if (StringUtils.isEmpty(workflowDefinitionCodes)) {
log.error("Parameter workflowDefinitionCodes is empty, projectCode is {}.", projectCode);
throw new ServiceException(Status.WORKFLOW_DEFINITION_CODES_IS_EMPTY);
}
if (projectCode != targetProjectCode) {
Project targetProject = projectDao.queryByCode(targetProjectCode);
projectService.checkHasProjectWritePermissionThrowException(loginUser, targetProject);
} else if (!requireSourceWritePermission) {
projectService.checkHasProjectWritePermissionThrowException(loginUser, project);
}
}
protected void doBatchOperateWorkflowDefinition(User loginUser,
long sourceProjectCode,
long targetProjectCode,
List<String> failedWorkflowList,
String workflowDefinitionCodes,
boolean isCopy) {
Set<Long> definitionCodes = Arrays.stream(workflowDefinitionCodes.split(Constants.COMMA)).map(Long::parseLong)
.collect(Collectors.toSet());View on GitHub (pinned to 02eac45a1b)
Solutions
- Provide a non-empty, comma-separated workflowDefinitionCodes value (e.g. '123,456').
- Add a client-side check: if the selected workflow list is empty, disable/blocked the copy/move action.
- Verify the request body encoding (form field name must be exactly workflowDefinitionCodes).
- Fix scripts/templates so they never issue the call with zero selected workflows.
Example fix
// before POST .../workflow/copy body: workflowDefinitionCodes= // after POST .../workflow/copy body: workflowDefinitionCodes=4860899582432&targetProjectCode=456
Defensive patterns
Strategy: validation
Validate before calling
if (selectedWorkflowCodes == null || selectedWorkflowCodes.trim().isEmpty()) {
throw new IllegalArgumentException("select at least one workflow to copy/move");
} Try / catch
try {
client.moveWorkflows(projectCode, codes, targetProjectCode);
} catch (ServiceException e) {
if (e.getCode() == Status.WORKFLOW_DEFINITION_CODES_IS_EMPTY.getCode()) {
// prompt user to select workflows
} else throw e;
} Prevention
- Disable copy/move buttons when no workflows are selected in the UI
- Guard scripts against issuing requests with empty code lists
- Assert the form field workflowDefinitionCodes is present and non-empty before submit
When it happens
Trigger: POST /projects/{projectCode}/workflow/copy or /move with empty or missing workflowDefinitionCodes body/form parameter (StringUtils.isEmpty check).
Common situations: Client sends an empty selection (user checked no workflows); a script building the request drops the parameter when the list is empty; UI state desync producing an empty codes string.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/ba8f7edf808f9037.
Report an issue: GitHub.