apache/dolphinscheduler · error · ServiceException

120033

120033

Error message

this cluster can not found in db.

What it means

updateClusterByCode looks up the target cluster by code via clusterDao.queryByClusterCode(code); when no row is found it throws ServiceException(Status.CLUSTER_NOT_EXISTS, name; code 120033). You cannot update a cluster registration that does not exist in the database.

Source

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

                                       String desc) {
        if (isNotAdmin(loginUser)) {
            throw new ServiceException(Status.USER_NO_OPERATION_PERM);
        }

        if (checkDescriptionLength(desc)) {
            throw new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR);
        }

        checkParams(name, config);

        Cluster clusterExistByName = clusterDao.queryByClusterName(name);
        if (clusterExistByName != null && !clusterExistByName.getCode().equals(code)) {
            throw new ServiceException(Status.CLUSTER_NAME_EXISTS, name);
        }

        Cluster clusterExist = clusterDao.queryByClusterCode(code);
        if (clusterExist == null) {
            throw new ServiceException(Status.CLUSTER_NOT_EXISTS, name);
        }

        if (!Constants.K8S_LOCAL_TEST_CLUSTER_CODE.equals(clusterExist.getCode())
                && !config.equals(ClusterConfUtils.getK8sConfig(clusterExist.getConfig()))) {
            try {
                k8sManager.getAndUpdateK8sClient(code, true);
            } catch (Exception e) {
                throw new ServiceException(Status.K8S_CLIENT_OPS_ERROR, name);
            }
        }

        // update cluster
        // need not update relation
        clusterExist.setConfig(config);
        clusterExist.setName(name);
        clusterExist.setDescription(desc);
        clusterExist.setUpdateTime(DateUtils.getCurrentDate());
        clusterDao.updateById(clusterExist);

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Verify the cluster code via the cluster list API/clusterDao.queryByClusterCode before updating.
  2. Recreate the cluster if it was deleted unintentionally (POST cluster endpoint).
  3. Correct the code in the calling script/UI; codes are generated per environment and are not portable.
  4. If the cluster exists but query fails, check DB connectivity and that the API points to the right database.

Example fix

// before
clusterService.updateClusterByCode(loginUser, 12345L, name, config, desc);
// after
Cluster c = clusterDao.queryByClusterCode(12345L);
if (c == null) {
    throw new IllegalArgumentException("cluster 12345 not found; create it first");
}
clusterService.updateClusterByCode(loginUser, 12345L, name, config, desc);
Defensive patterns

Strategy: validation

Validate before calling

// Java
Cluster cluster = clusterDao.queryByClusterCode(code);
if (cluster == null) {
    throw new IllegalArgumentException("cluster " + code + " does not exist; create it before updating");
}

Try / catch

try {
    clusterService.updateClusterByCode(loginUser, code, name, config, desc);
} catch (ServiceException e) {
    if (e.getCode() == 120033) {
        // refresh cluster list; code may be stale or cluster deleted
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: PUT /clusters/{code} (or updateClusterByCode) with a cluster code that has no row in t_ds_cluster — wrong code, cluster already deleted, or code from another environment's database.

Common situations: Stale UI tab after another admin deleted the cluster; scripts referencing hard-coded codes copied from a different installation; updates after a failed migration left clusters missing.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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