apache/dolphinscheduler · error · ServiceException

PROJECT_PARAMETER_NOT_EXISTS

PROJECT_PARAMETER_NOT_EXISTS

Error message

PROJECT_PARAMETER_NOT_EXISTS

What it means

Thrown by ProjectParameterServiceImpl.batchDeleteProjectParametersByCodes when some requested parameter codes do not exist under the given project. The missing codes are joined into a comma string and passed as the exception argument.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectParameterServiceImpl.java:214

        if (StringUtils.isEmpty(codes)) {
            log.error("Project parameter codes is empty, projectCode is {}.", projectCode);
            putMsg(result, Status.PROJECT_PARAMETER_CODE_EMPTY);
            return result;
        }

        Set<Long> requestCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong)
                .collect(Collectors.toSet());
        List<ProjectParameter> projectParameterList = projectParameterMapper.queryByCodes(requestCodeSet);
        Set<Long> actualCodeSet =
                projectParameterList.stream().map(ProjectParameter::getCode).collect(Collectors.toSet());
        // requestCodeSet - actualCodeSet
        Set<Long> diffCode =
                requestCodeSet.stream().filter(code -> !actualCodeSet.contains(code)).collect(Collectors.toSet());

        String diffCodeString = diffCode.stream().map(String::valueOf).collect(Collectors.joining(Constants.COMMA));
        if (CollectionUtils.isNotEmpty(diffCode)) {
            log.error("Project parameter does not exist, codes:{}.", diffCodeString);
            throw new ServiceException(Status.PROJECT_PARAMETER_NOT_EXISTS, diffCodeString);
        }

        for (ProjectParameter projectParameter : projectParameterList) {
            this.deleteProjectParametersByCode(loginUser, projectCode, projectParameter.getCode());
        }

        putMsg(result, Status.SUCCESS);
        return result;
    }

    @Override
    public Result queryProjectParameterListPaging(User loginUser, long projectCode, Integer pageSize, Integer pageNo,
                                                  String searchVal, String projectParameterDataType) {
        Result result = new Result();

        Project project = projectDao.queryByCode(projectCode);
        projectService.checkProjectAndAuthThrowException(loginUser, project, PROJECT);

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Cross-check requested codes against the project's parameter list (queryProjectParameters) and remove the missing ones.
  2. Verify you are using parameter codes, not database IDs, and the correct projectCode.
  3. Re-fetch the parameter list before each batch delete to avoid stale codes.
  4. If partial deletion is acceptable, diff codes client-side and only send existing ones.

Example fix

// before
projectParameterService.batchDeleteProjectParametersByCodes(loginUser, projectCode, allCodes);
// after
List<ProjectParameter> existing = projectParameterService.queryProjectParameters(loginUser, projectCode, searchVal);
Set<Long> validCodes = existing.stream().map(ProjectParameter::getCode).collect(Collectors.toSet());
Set<Long> deletable = allCodes.stream().filter(validCodes::contains).collect(Collectors.toSet());
projectParameterService.batchDeleteProjectParametersByCodes(loginUser, projectCode, deletable);
Defensive patterns

Strategy: validation

Validate before calling

List<ProjectParameter> existing =
    projectParameterService.queryProjectParameters(loginUser, projectCode, "");
Set<Long> validCodes = existing.stream()
    .map(ProjectParameter::getCode).collect(Collectors.toSet());
Set<Long> toDelete = requestedCodes.stream()
    .filter(validCodes::contains).collect(Collectors.toSet());

Try / catch

try {
    projectParameterService.batchDeleteProjectParametersByCodes(loginUser, projectCode, codes);
} catch (ServiceException e) {
    // PROJECT_PARAMETER_NOT_EXISTS - e message lists missing codes
}

Prevention

When it happens

Trigger: Calling POST /project-parameter/batch-delete with codes that are not present in t_ds_project_parameter for the given projectCode - already deleted, wrong project, or codes belonging to workflow/task-level parameters instead.

Common situations: Batch delete built from a stale UI list after another user deleted parameters; codes copied from a different project; ID-vs-code confusion (passing primary keys instead of parameter codes).

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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