apache/dolphinscheduler · error · ServiceException

120025

120025

Error message

delete cluster error

What it means

Thrown by deleteClusterByCode when clusterDao.deleteByCode(code) returns false, i.e. the delete operation on the cluster record did not remove any row. ServiceException(Status.DELETE_CLUSTER_ERROR, code 120025). Typically means the cluster row does not exist (already deleted) or the DAO delete failed silently.

Source

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

     * @param loginUser login user
     * @param code      cluster code
     */
    @Override
    public void deleteClusterByCode(User loginUser, Long code) {
        if (isNotAdmin(loginUser)) {
            throw new ServiceException(Status.USER_NO_OPERATION_PERM);
        }

        long relatedNamespaceNumber = k8sNamespaceDao.countByClusterCode(code);

        if (relatedNamespaceNumber > 0) {
            throw new ServiceException(Status.DELETE_CLUSTER_RELATED_NAMESPACE_EXISTS);
        }

        if (clusterDao.deleteByCode(code)) {
            return;
        }
        throw new ServiceException(Status.DELETE_CLUSTER_ERROR);
    }

    /**
     * update cluster
     *
     * @param loginUser login user
     * @param code      cluster code
     * @param name      cluster name
     * @param config    cluster config
     * @param desc      cluster desc
     */
    @Override
    public Cluster updateClusterByCode(User loginUser,
                                       Long code,
                                       String name,
                                       String config,
                                       String desc) {
        if (isNotAdmin(loginUser)) {

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Check that the cluster still exists (cluster list page or clusterDao.queryByClusterCode) before deleting; if it's gone, treat the delete as already done.
  2. Check application/DB logs for the underlying database error if the row does exist.
  3. Retry after confirming DB connectivity; if the row exists and delete still fails, inspect the datasource configuration.
  4. Refresh the cluster list in the UI to resync state before retrying.

Example fix

// before: blind retry on failure
try {
    clusterService.deleteClusterByCode(loginUser, code);
} catch (ServiceException e) { /* retry blindly */ }
// after: check existence first
if (clusterDao.queryByClusterCode(code) == null) {
    return; // already deleted
}
clusterService.deleteClusterByCode(loginUser, code);
Defensive patterns

Strategy: validation

Validate before calling

// Java
if (clusterDao.queryByClusterCode(code) == null) {
    return; // nothing to delete, avoid DELETE_CLUSTER_ERROR
}

Try / catch

try {
    clusterService.deleteClusterByCode(loginUser, code);
} catch (ServiceException e) {
    if (e.getCode() == 120025) {
        log.warn("cluster {} already gone or delete failed; re-checking existence", code);
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling deleteClusterByCode for a cluster code that no longer exists in the t_ds_cluster table, or a DB-level delete failure that made deleteByCode return false.

Common situations: Double-clicking a delete action / retrying an already-successful delete; deleting a cluster that was removed by another admin concurrently; DB connectivity or constraint issues causing the delete to affect zero rows.

Related errors


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