apache/dolphinscheduler · error · ServiceException
50026
50026
Error message
batch delete workflow definition by codes error: {0} What it means
Thrown by batchDeleteWorkflowDefinitionByCodes when one or more of the submitted workflow definition codes do not exist in the project. The service computes the set difference between the requested codes and the codes actually found in the database; a non-empty difference means 'resource not found' for part of the batch, and the whole batch is aborted. The error message embeds the offending codes.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:824
public void batchDeleteWorkflowDefinitionByCodes(User loginUser, long projectCode, String codes) {
if (StringUtils.isEmpty(codes)) {
log.error("Parameter workflowDefinitionCodes is empty, projectCode is {}.", projectCode);
throw new ServiceException(Status.WORKFLOW_DEFINITION_CODES_IS_EMPTY);
}
Set<Long> definitionCodes = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong)
.collect(Collectors.toSet());
List<WorkflowDefinition> workflowDefinitionList = workflowDefinitionDao.queryByCodes(definitionCodes);
Set<Long> queryCodes =
workflowDefinitionList.stream().map(WorkflowDefinition::getCode).collect(Collectors.toSet());
// definitionCodes - queryCodes
Set<Long> diffCode =
definitionCodes.stream().filter(code -> !queryCodes.contains(code)).collect(Collectors.toSet());
if (CollectionUtils.isNotEmpty(diffCode)) {
log.error("workflow definition does not exist, workflowDefinitionCodes:{}.",
diffCode.stream().map(String::valueOf).collect(Collectors.joining(Constants.COMMA)));
throw new ServiceException(Status.BATCH_DELETE_WORKFLOW_DEFINE_BY_CODES_ERROR,
diffCode.stream().map(code -> code + "[workflow definition not exist]")
.collect(Collectors.joining(Constants.COMMA)));
}
for (WorkflowDefinition workflowDefinition : workflowDefinitionList) {
try {
this.deleteWorkflowDefinitionByCode(loginUser, workflowDefinition.getCode());
} catch (Exception e) {
throw new ServiceException(Status.DELETE_WORKFLOW_DEFINE_ERROR, workflowDefinition.getName(),
e.getMessage());
}
}
}
/**
* workflow definition want to delete whether used in other task, should throw exception when have be used.
* <p>
* This function avoid delete workflow definition already dependencies by other tasks by accident.View on GitHub (pinned to 02eac45a1b)
Solutions
- Query each code first (workflowDefinitionDao.queryByCode) and remove nonexistent codes from the batch before calling the API.
- Re-fetch the workflow list to refresh codes and retry only with codes that still exist.
- Verify the codes belong to the correct project code you are operating on.
Example fix
// before
workflowDefinitionService.batchDeleteWorkflowDefinitionByCodes(loginUser, projectCode, Arrays.asList(1L, 2L, 3L));
// after
List<Long> valid = codes.stream()
.filter(c -> workflowDefinitionDao.queryByCode(c).isPresent())
.collect(Collectors.toList());
workflowDefinitionService.batchDeleteWorkflowDefinitionByCodes(loginUser, projectCode, valid); Defensive patterns
Strategy: validation
Validate before calling
Set<Long> existing = codes.stream()
.filter(c -> workflowDefinitionDao.queryByCode(c).isPresent())
.collect(Collectors.toSet());
if (!existing.equals(new HashSet<>(codes))) throw new IllegalArgumentException("some codes do not exist"); Try / catch
try { service.batchDeleteWorkflowDefinitionByCodes(user, projectCode, codes); }
catch (ServiceException e) { /* parse nonexistent codes from e.getMessage() and resubmit valid subset */ } Prevention
- Always resolve codes from a fresh listWorkflows query
- Make delete calls idempotent on the caller side (ignore already-missing codes)
- Avoid sharing code lists across projects
When it happens
Trigger: Calling batchDeleteWorkflowDefinitionByCodes with codes that were already deleted, belong to another project, were mistyped, or were fetched in a stale UI listing before another user deleted them.
Common situations: Double-delete from concurrent sessions or retried API calls; deleting workflows in a batch where one was removed moments earlier; copying codes from a different project's export; stale frontend caches after an admin purge.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- 10105
- 50003
- 50060
- WORKFLOW_DEFINITION_NOT_EXIST
- The releaseState {releaseState} is illegal, please check it.
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/25a6f5ab30370365.
Report an issue: GitHub.