apache/dolphinscheduler · warning · ServiceException

ENVIRONMENT_CONFIG_IS_NULL

ENVIRONMENT_CONFIG_IS_NULL

Error message

ENVIRONMENT_CONFIG_IS_NULL

What it means

Thrown by checkParams (called from createEnvironment/updateEnvironmentByCode) when the environment config is null or blank. The config field holds the environment's key=value settings; without it the environment is unusable, so validation fails with ENVIRONMENT_CONFIG_IS_NULL.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/EnvironmentServiceImpl.java:426

        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());
                throw new ServiceException(Status.UPDATE_ENVIRONMENT_WORKER_GROUP_RELATION_ERROR, workerGroup,
                        environmentName, collect);
            }
        }
    }

    protected void checkParams(String name, String config, String workerGroups) {
        if (StringUtils.isEmpty(name)) {
            throw new ServiceException(Status.ENVIRONMENT_NAME_IS_NULL);
        }
        if (StringUtils.isEmpty(config)) {
            throw new ServiceException(Status.ENVIRONMENT_CONFIG_IS_NULL);
        }
        if (StringUtils.isNotEmpty(workerGroups)) {
            try {
                JSONUtils.parseObject(workerGroups, new TypeReference<List<String>>() {
                });
            } catch (IllegalArgumentException e) {
                throw new ServiceException(Status.ENVIRONMENT_WORKER_GROUPS_IS_INVALID);
            }
        }
    }

}

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Supply a valid config string (e.g. key=value pairs) with the request
  2. Ensure the UI/config editor content is serialized into the request body
  3. For intentionally empty configs, use a placeholder like a comment line if the schema requires non-empty
  4. Check import/export tooling for dropped config fields

Example fix

// before
createEnvironment(loginUser, "prod", desc, "", groups); // throws
// after
createEnvironment(loginUser, "prod", desc, "JAVA_HOME=/usr/lib/jvm", groups);
Defensive patterns

Strategy: validation

Validate before calling

if (config == null || config.trim().isEmpty()) {
    throw new IllegalArgumentException("environment config is required");
}

Try / catch

try {
    environmentService.createEnvironment(loginUser, name, desc, config, workerGroups);
} catch (ServiceException e) {
    if (e.getCode() == Status.ENVIRONMENT_CONFIG_IS_NULL.getCode()) {
        // supply config and retry
    } else { throw e; }
}

Prevention

When it happens

Trigger: createEnvironment or updateEnvironmentByCode called with config == null or "".

Common situations: Users saving an environment without pasting any config; import tooling producing empty config fields; frontend sending config as empty string after clearing the editor.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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