iflytek/astron-agent · error · BusinessException
NOTIFICATION_MARK_READ_FAILED
NOTIFICATION_MARK_READ_FAILED
Error message
NOTIFICATION_MARK_READ_FAILED
What it means
Any unexpected exception thrown while marking notifications as read (lock issues, data-layer errors, NPEs) is caught, logged, and rethrown as BusinessException(ResponseEnum.NOTIFICATION_MARK_READ_FAILED). It indicates the mark-read operation failed server-side, not a validation problem.
Solutions
- Check server logs for the logged 'Failed to mark notifications as read' stack trace to find the root cause.
- Ensure the request sets either markAll=true or a non-empty notificationIds list.
- Verify database and distributed-lock (Redis) services are healthy; retry after transient failures.
Example fix
// before
{"receiverUid":"u1"} // markAll null, notificationIds null -> NPE -> MARK_READ_FAILED
// after
{"receiverUid":"u1","markAll":true} Defensive patterns
Strategy: try-catch
Validate before calling
if (!req || (!req.markAll && (req.notificationIds == null || req.notificationIds.length === 0))) { throw new Error('provide markAll or notificationIds'); } Try / catch
try { markNotificationsAsRead(uid, req); } catch (BusinessException e) { if (e.getCode() == ResponseEnum.NOTIFICATION_MARK_READ_FAILED.getCode()) { /* check server logs; retry after backoff */ } } Prevention
- Always set markAll or a non-empty notificationIds list to avoid internal NPEs.
- Monitor DB and Redis lock service health.
- Retry with backoff on transient failures.
When it happens
Trigger: Database write failure in notificationDataService while updating read status; distributed lock contention/timeout around markNotificationsAsRead; NPE when request or request.getNotificationIds() is null (bypassing the uid-only validation).
Common situations: DB connection pool exhausted during traffic spikes; Redis lock service unavailable; clients sending markAll=null with notificationIds=null causing internal NPE.
Related errors
- NOTIFICATION_DELETE_FAILED
- CREATE_BOT_FAILED
- UPDATE_BOT_FAILED
- PARAMETER_ERROR
- NOTIFICATION_TYPE_INVALID
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/2f2ea5320b16c85a.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/notification/impl/NotificationServiceImpl.java:104
throw new BusinessException(ResponseEnum.PARAMETER_ERROR);
}
try {
if (Boolean.TRUE.equals(request.getMarkAll())) {
// Mark all unread messages as read
markAllNotificationsAsRead(receiverUid);
} else if (!CollectionUtils.isEmpty(request.getNotificationIds())) {
// Mark specific messages as read
markSpecificNotificationsAsRead(receiverUid, request.getNotificationIds());
}
log.info("Notifications marked as read successfully, receiverUid: {}, markAll: {}, notificationIds: {}",
receiverUid, request.getMarkAll(), request.getNotificationIds());
return true;
} catch (Exception e) {
log.error("Failed to mark notifications as read, receiverUid: {}", receiverUid, e);
throw new BusinessException(ResponseEnum.NOTIFICATION_MARK_READ_FAILED);
}
}
@Override
@Transactional
@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);View on GitHub (pinned to 5e758547a8)