{"record":{"id":"ba8f7edf808f9037","repo":"apache/dolphinscheduler","slug":"workflow-definition-codes-is-empty","errorCode":"WORKFLOW_DEFINITION_CODES_IS_EMPTY","errorMessage":"WORKFLOW_DEFINITION_CODES_IS_EMPTY: workflow definition codes is empty","messagePattern":"WORKFLOW_DEFINITION_CODES_IS_EMPTY: workflow definition codes is empty","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"warning","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java","lineNumber":1323,"sourceCode":"        checkBatchOperateResult(projectCode, targetProjectCode, failedWorkflowList, false);\n    }\n\n    private void checkParams(User loginUser,\n                             long projectCode,\n                             String workflowDefinitionCodes,\n                             long targetProjectCode,\n                             String perm,\n                             boolean requireSourceWritePermission) {\n        Project project = projectDao.queryByCode(projectCode);\n        if (requireSourceWritePermission) {\n            projectService.checkHasProjectWritePermissionThrowException(loginUser, project);\n        } else {\n            projectService.checkProjectAndAuthThrowException(loginUser, project, perm);\n        }\n\n        if (StringUtils.isEmpty(workflowDefinitionCodes)) {\n            log.error(\"Parameter workflowDefinitionCodes is empty, projectCode is {}.\", projectCode);\n            throw new ServiceException(Status.WORKFLOW_DEFINITION_CODES_IS_EMPTY);\n        }\n\n        if (projectCode != targetProjectCode) {\n            Project targetProject = projectDao.queryByCode(targetProjectCode);\n            projectService.checkHasProjectWritePermissionThrowException(loginUser, targetProject);\n        } else if (!requireSourceWritePermission) {\n            projectService.checkHasProjectWritePermissionThrowException(loginUser, project);\n        }\n    }\n\n    protected void doBatchOperateWorkflowDefinition(User loginUser,\n                                                    long sourceProjectCode,\n                                                    long targetProjectCode,\n                                                    List<String> failedWorkflowList,\n                                                    String workflowDefinitionCodes,\n                                                    boolean isCopy) {\n        Set<Long> definitionCodes = Arrays.stream(workflowDefinitionCodes.split(Constants.COMMA)).map(Long::parseLong)\n                .collect(Collectors.toSet());","sourceCodeStart":1305,"sourceCodeEnd":1341,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java#L1305-L1341","documentation":"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.","triggerScenarios":"POST /projects/{projectCode}/workflow/copy or /move with empty or missing workflowDefinitionCodes body/form parameter (StringUtils.isEmpty check).","commonSituations":"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.","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."],"exampleFix":"// before\nPOST .../workflow/copy  body: workflowDefinitionCodes=\n// after\nPOST .../workflow/copy  body: workflowDefinitionCodes=4860899582432&targetProjectCode=456","handlingStrategy":"validation","validationCode":"if (selectedWorkflowCodes == null || selectedWorkflowCodes.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"select at least one workflow to copy/move\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    client.moveWorkflows(projectCode, codes, targetProjectCode);\n} catch (ServiceException e) {\n    if (e.getCode() == Status.WORKFLOW_DEFINITION_CODES_IS_EMPTY.getCode()) {\n        // prompt user to select workflows\n    } else throw e;\n}","preventionTips":["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"],"tags":["query-parameter","empty-argument","workflow-move"],"backgroundTag":"missing-required-argument","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}