apache/dolphinscheduler · error
PROJECT_PARAMETER_ALREADY_EXISTS
PROJECT_PARAMETER_ALREADY_EXISTS
Error message
ProjectParameter {} already exists. What it means
createProjectParameter returns PROJECT_PARAMETER_ALREADY_EXISTS when a ProjectParameter row with the same projectCode and paramName already exists. Parameter names must be unique within a project, so duplicate creation is rejected.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectParameterServiceImpl.java:85
@Override
@Transactional
public Result createProjectParameter(User loginUser, long projectCode, String projectParameterName,
String projectParameterValue, String projectParameterDataType) {
Result result = new Result();
// check if user have write perm for project
Project project = projectDao.queryByCode(projectCode);
projectService.checkHasProjectWritePermissionThrowException(loginUser, project);
// check if project parameter name exists
ProjectParameter projectParameter = projectParameterMapper.selectOne(new QueryWrapper<ProjectParameter>()
.lambda()
.eq(ProjectParameter::getProjectCode, projectCode)
.eq(ProjectParameter::getParamName, projectParameterName));
if (projectParameter != null) {
log.warn("ProjectParameter {} already exists.", projectParameter.getParamName());
putMsg(result, Status.PROJECT_PARAMETER_ALREADY_EXISTS, projectParameter.getParamName());
return result;
}
Date now = new Date();
projectParameter = ProjectParameter
.builder()
.paramName(projectParameterName)
.paramValue(projectParameterValue)
.paramDataType(projectParameterDataType)
.code(CodeGenerateUtils.genCode())
.projectCode(projectCode)
.userId(loginUser.getId())
.operator(loginUser.getId())
.createTime(now)
.updateTime(now)
.build();View on GitHub (pinned to 02eac45a1b)
Solutions
- Use the update (PUT /project-parameter) endpoint instead of create to change an existing parameter's value.
- Rename the new parameter to a unique name within the project.
- Query existing parameters first (GET /project-parameter/list) and skip creation if present.
Example fix
// before
service.createProjectParameter(user, code, "jdbc.url", "jdbc:..."); // fails if exists
// after
if (projectParameterService.listProjectParameter(user, code, "jdbc.url", 1, 10).getResult() == null) {
service.createProjectParameter(user, code, "jdbc.url", "jdbc:...");
} Defensive patterns
Strategy: try-catch
Validate before calling
long existing = projectParameterMapper.selectCount(new LambdaQueryWrapper<ProjectParameter>()
.eq(ProjectParameter::getProjectCode, code)
.eq(ProjectParameter::getParamName, name));
if (existing > 0) { /* update instead of create */ } Try / catch
catch (ServiceException e) { if (e.getCode() == Status.PROJECT_PARAMETER_ALREADY_EXISTS) { /* fall back to update */ } } Prevention
- Check name availability before create.
- Prefer upsert semantics in automation scripts.
- Enforce unique parameter naming conventions per project.
When it happens
Trigger: POST /project-parameter with a paramName that already exists in the given projectCode, e.g. creating parameter 'jdbc.url' twice in the same project.
Common situations: Re-submitting a create form after a previous successful save; automation scripts creating parameters idempotently; user typing a name that collides with an existing parameter.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/3789447b32c8531d.
Report an issue: GitHub.