iflytek/astron-agent · error · BusinessException

NOTIFICATION_DELETE_FAILED

NOTIFICATION_DELETE_FAILED

Error message

NOTIFICATION_DELETE_FAILED

What it means

Any non-business exception during notification deletion (data-layer errors, lock failures) is caught, logged, and rethrown as BusinessException(ResponseEnum.NOTIFICATION_DELETE_FAILED). BusinessException is rethrown unchanged, so this code always signals an unexpected server-side delete failure.

Solutions

  1. Inspect server logs for 'Failed to delete notification' with receiverUid and notificationId to find the root cause.
  2. Verify database connectivity and health; retry once transient issues clear.
  3. Check the distributed-lock (Redis) service status.
  4. If persistent, examine notificationDataService.deleteUserNotification for SQL/constraint errors.

Example fix

// before
// no retry on transient DB failure
notificationService.deleteNotification(uid, id);
// after
try {
    notificationService.deleteNotification(uid, id);
} catch (BusinessException e) {
    // retry with backoff for NOTIFICATION_DELETE_FAILED
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (receiverUid != null && notificationId != null) { /* proceed */ }

Try / catch

try { deleteNotification(uid, id); } catch (BusinessException e) { if (e.getCode() == ResponseEnum.NOTIFICATION_DELETE_FAILED.getCode()) { /* retry with backoff; alert if persistent */ } }

Prevention

When it happens

Trigger: Database delete fails (connection issues, constraint violations, table lock); distributed lock around deleteNotification errors; serialization/persistence layer exceptions inside deleteUserNotification.

Common situations: DB outage or pool exhaustion; deadlock on the notification table during bulk operations; Redis lock service unavailable causing lock acquisition failures inside the annotated method.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/f8f6ad0db130f818. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/notification/impl/NotificationServiceImpl.java:135

        if (receiverUid == null || notificationId == null) {
            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);
        }

        try {
            int deleted = notificationDataService.deleteUserNotification(receiverUid, notificationId);
            if (deleted > 0) {
                log.info("Notification deleted successfully, receiverUid: {}, notificationId: {}",
                        receiverUid, notificationId);
                return true;
            } else {
                throw new BusinessException(ResponseEnum.NOTIFICATION_NOT_EXISTS);
            }
        } catch (BusinessException e) {
            throw e; // Re-throw business exception
        } catch (Exception e) {
            log.error("Failed to delete notification, receiverUid: {}, notificationId: {}",
                    receiverUid, notificationId, e);
            throw new BusinessException(ResponseEnum.NOTIFICATION_DELETE_FAILED);
        }
    }

    // ==================== System Management ====================

    @Override
    @Transactional
    public int cleanExpiredNotifications() {
        try {
            LocalDateTime expireTime = LocalDateTime.now();
            int deleted = notificationDataService.deleteExpiredNotifications(expireTime);
            log.info("Expired notifications cleaned, count: {}", deleted);
            return deleted;
        } catch (Exception e) {
            log.error("Failed to clean expired notifications", e);
            throw new BusinessException(ResponseEnum.OPERATION_FAILED);
        }
    }

View on GitHub (pinned to 5e758547a8)