iflytek/astron-agent · warning · BusinessException
NOTIFICATION_NOT_EXISTS
NOTIFICATION_NOT_EXISTS
Error message
NOTIFICATION_NOT_EXISTS
What it means
When deleteUserNotification reports zero deleted rows, the service concludes the notification does not exist for that user and throws BusinessException(ResponseEnum.NOTIFICATION_NOT_EXISTS). BusinessException is rethrown as-is, so this error specifically means 'no matching row', unlike generic failures.
Solutions
- Confirm the notificationId exists and belongs to the given receiverUid before deleting.
- Handle NOTIFICATION_NOT_EXISTS idempotently on the client (treat repeat deletes as success).
- Refresh the notification list after deletes so stale ids are not reused.
- Check tenant/space filters if the row exists but scoped queries cannot see it.
Example fix
// before
deleteNotification(uid, id); // id already removed, throws
// after
try {
deleteNotification(uid, id);
} catch (BusinessException e) {
// treat NOTIFICATION_NOT_EXISTS as already-deleted success
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!knownNotificationIds.has(notificationId)) { refreshList(); return; } Try / catch
try { deleteNotification(uid, id); } catch (BusinessException e) { if (e.getCode() == ResponseEnum.NOTIFICATION_NOT_EXISTS.getCode()) { /* treat as already deleted: remove from local list, no error */ } } Prevention
- Treat NOTIFICATION_NOT_EXISTS as idempotent success in clients.
- Refresh lists after deletes to avoid stale ids.
- Avoid reusing ids across environments.
When it happens
Trigger: Deleting an already-deleted notification; using a notificationId belonging to another user (uid/id mismatch); stale UI lists retrying deletes of purged rows; wrong tenant/space data isolation causing lookup to miss.
Common situations: Double-click on delete buttons firing the request twice; cached notification lists out of sync with DB; cross-environment ids (test id used in prod).
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/2503003fdf869f6e.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/notification/impl/NotificationServiceImpl.java:128
@DistributedLock(
key = "notification:delete:#{#receiverUid}",
waitTime = 2L,
leaseTime = 5L,
failStrategy = DistributedLock.FailStrategy.CONTINUE,
description = "Lock for deleting user messages")
public boolean deleteNotification(String receiverUid, Long notificationId) {
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);View on GitHub (pinned to 5e758547a8)