apache/dolphinscheduler · error · ServiceException

110012

110012

Error message

failed to delete the alert instance, there is an alarm group associated with this alert instance

What it means

Thrown by deleteById when checkHasAssociatedAlertGroup() finds at least one alert group referencing this alert plugin instance. DolphinScheduler refuses to delete alert instances still in use by an alert group.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AlertPluginInstanceServiceImpl.java:169

    /**
     * delete alert plugin instance
     *
     * @param loginUser             login user
     * @param alertPluginInstanceId id
     * @return result
     */
    @Override
    @Transactional
    public void deleteById(User loginUser, int alertPluginInstanceId) {
        if (!canOperatorPermissions(loginUser, null, AuthorizationType.ALERT_PLUGIN_INSTANCE, ALERT_PLUGIN_DELETE)) {
            throw new ServiceException(Status.USER_NO_OPERATION_PERM);
        }

        // check if there is an associated alert group
        boolean hasAssociatedAlertGroup = checkHasAssociatedAlertGroup(String.valueOf(alertPluginInstanceId));
        if (hasAssociatedAlertGroup) {
            throw new ServiceException(Status.DELETE_ALERT_PLUGIN_INSTANCE_ERROR_HAS_ALERT_GROUP_ASSOCIATED);
        }

        alertPluginInstanceMapper.deleteById(alertPluginInstanceId);
    }

    /**
     * get alert plugin instance
     *
     * @param loginUser login user
     * @param id get id
     * @return alert plugin
     */
    @Override
    public AlertPluginInstance getById(User loginUser, int id) {
        if (!canOperatorPermissions(loginUser, null, AuthorizationType.ALERT_PLUGIN_INSTANCE, ALARM_INSTANCE_MANAGE)) {
            throw new ServiceException(Status.USER_NO_OPERATION_PERM);
        }
        return alertPluginInstanceMapper.selectById(id);

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Remove the alert instance from all alert groups that reference it (edit or delete those groups in Security Center -> Alert group management).
  2. Re-attempt the deletion once no alert group is associated.
  3. Query t_ds_alert_group to find which groups reference the instance id.

Example fix

// before
deleteAlertPluginInstance(instanceId);
// after
List<AlertGroup> groups = alertGroupMapper.listByAlertInstanceId(instanceId);
if (!groups.isEmpty()) { /* detach or delete groups first */ }
deleteAlertPluginInstance(instanceId);
Defensive patterns

Strategy: validation

Validate before calling

// check associations before delete
List<AlertGroup> groups = alertGroupService.listByAlertInstanceId(instanceId);
if (!groups.isEmpty()) throw new IllegalStateException("instance used by groups: " + groups.stream().map(AlertGroup::getGroupName).collect(Collectors.toList()));

Try / catch

try { alertPluginInstanceService.deleteById(loginUser, instanceId); } catch (ServiceException e) { if (e.getCode() == Status.DELETE_ALERT_PLUGIN_INSTANCE_ERROR_HAS_ALERT_GROUP_ASSOCIATED.getCode()) { /* show which groups reference the instance */ } throw e; }

Prevention

When it happens

Trigger: Deleting an alert plugin instance whose id appears in the alertGroupId association of any alert group in t_ds_alert_group.

Common situations: Trying to remove an alert instance that is the notification target of a configured alert group; cleanup scripts unaware of group references.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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