apache/dolphinscheduler · warning · ServiceException
ENVIRONMENT_NAME_IS_NULL
ENVIRONMENT_NAME_IS_NULL
Error message
Status.ENVIRONMENT_NAME_IS_NULL
What it means
Thrown in EnvironmentServiceImpl.verifyEnvironment when the environmentName parameter is empty or null. It is an input-validation guard in the name-verification path; an empty name can never identify a valid environment, so the request is rejected immediately.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java:396
relation.setUpdateTime(new Date());
relation.setCreateTime(new Date());
relation.setOperator(loginUser.getId());
relationMapper.insert(relation);
}
});
return env;
}
/**
* verify environment name
*
* @param environmentName environment name
*/
@Override
public void verifyEnvironment(String environmentName) {
if (StringUtils.isEmpty(environmentName)) {
log.warn("parameter environment name is empty.");
throw new ServiceException(Status.ENVIRONMENT_NAME_IS_NULL);
}
Environment environment = environmentMapper.queryByEnvironmentName(environmentName);
if (environment != null) {
log.warn("Environment with the same name already exist, name:{}.", environment.getName());
throw new ServiceException(Status.ENVIRONMENT_NAME_EXISTS, environmentName);
}
}
private void checkUsedEnvironmentWorkerGroupRelation(Set<String> deleteKeySet,
String environmentName, Long environmentCode) {
for (String workerGroup : deleteKeySet) {
List<TaskDefinition> taskDefinitionList =
taskDefinitionDao.queryByEnvironmentCodeAndWorkerGroup(environmentCode, workerGroup);
if (Objects.nonNull(taskDefinitionList) && taskDefinitionList.size() != 0) {
Set<String> collect =
taskDefinitionList.stream().map(TaskDefinition::getName).collect(Collectors.toSet());View on GitHub (pinned to 02eac45a1b)
Solutions
- Supply a non-empty environmentName in the request
- Validate the name field client-side before calling the API
- Fix variable interpolation in scripts so the name isn't empty
- Check that the request body field name matches 'environmentName'/'name' expected by the endpoint
Example fix
// before
environmentService.verifyEnvironment(params.get("envName")); // null when key missing
// after
String envName = params.get("envName");
if (envName == null || envName.isEmpty()) {
throw new IllegalArgumentException("environmentName is required");
}
environmentService.verifyEnvironment(envName); Defensive patterns
Strategy: validation
Validate before calling
if (environmentName == null || environmentName.trim().isEmpty()) {
throw new IllegalArgumentException("environmentName must be non-empty");
} Type guard
boolean isValidName(String s) { return s != null && !s.trim().isEmpty(); } Try / catch
try {
environmentService.verifyEnvironment(name);
} catch (ServiceException e) {
if (e.getCode() == Status.ENVIRONMENT_NAME_IS_NULL.getCode()) {
// prompt user for a name
} else { throw e; }
} Prevention
- Mark name as required in forms and API clients
- Validate payloads before sending (non-null, non-blank)
- Beware unset variables in scripts producing empty strings
When it happens
Trigger: Calling verifyEnvironment(null) or verifyEnvironment("") — typically reached from createEnvironment when the request body omitted the name field.
Common situations: Client form submissions missing the name field; scripts that build JSON payloads with unfilled variables (null interpolated); API consumers using the wrong request parameter name.
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
- DESCRIPTION_TOO_LONG_ERROR
- ENVIRONMENT_CONFIG_IS_NULL
- ENVIRONMENT_NAME_EXISTS
- CREATE_ENVIRONMENT_ERROR
- QUERY_ENVIRONMENT_BY_CODE_ERROR
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/ab5de0729818d80a.
Report an issue: GitHub.