apache/dolphinscheduler · warning · ServiceException

120022

120022

Error message

this cluster name shouldn't be empty.

What it means

verifyCluster validates that the cluster name is non-empty; if StringUtils.isEmpty(clusterName) it throws ServiceException(Status.CLUSTER_NAME_IS_NULL, code 120022) with message "this cluster name shouldn't be empty.". It is the first input check before querying the database for name uniqueness.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ClusterServiceImpl.java:276

        clusterDao.updateById(clusterExist);
        return clusterExist;
    }

    /**
     * verify cluster name
     *
     * @param loginUser   login user
     * @param clusterName cluster name
     * @return true if the cluster name not exists, otherwise return false
     */
    @Override
    public void verifyCluster(User loginUser, String clusterName) {
        if (isNotAdmin(loginUser)) {
            throw new ServiceException(Status.USER_NO_OPERATION_PERM);
        }

        if (StringUtils.isEmpty(clusterName)) {
            throw new ServiceException(Status.CLUSTER_NAME_IS_NULL);
        }

        Cluster cluster = clusterDao.queryByClusterName(clusterName);
        if (cluster != null) {
            throw new ServiceException(Status.CLUSTER_NAME_EXISTS);
        }
    }

    protected void checkParams(String name, String config) {
        if (StringUtils.isEmpty(name)) {
            throw new ServiceException(Status.CLUSTER_NAME_IS_NULL);
        }
        if (StringUtils.isEmpty(config)) {
            throw new ServiceException(Status.CLUSTER_CONFIG_IS_NULL);
        }
    }

}

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Only call verifyCluster after the user entered a name; validate non-empty client-side.
  2. Trim the input and check for emptiness before invoking the endpoint.
  3. Fix scripts to fail fast when the name variable is unset.
  4. Ensure the query parameter is properly included in the request.

Example fix

// before
String name = config.getProperty("cluster.name");
clusterService.verifyCluster(loginUser, name);
// after
String name = config.getProperty("cluster.name");
if (name == null || name.trim().isEmpty()) {
    throw new IllegalArgumentException("cluster name required");
}
clusterService.verifyCluster(loginUser, name.trim());
Defensive patterns

Strategy: validation

Validate before calling

// Java
if (name == null || name.trim().isEmpty()) {
    throw new IllegalArgumentException("clusterName must be non-empty");
}

Prevention

When it happens

Trigger: GET /clusters/verify (or verifyCluster) called with clusterName="", null, or a whitespace-only name — usually a form submitted before the name field was filled or a missing query parameter.

Common situations: Frontend calling the verify API on field focus before any input; scripts interpolating an unset variable into the URL; clients trimming names to empty strings.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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