iflytek/astron-agent · error · BusinessException
OPERATION_FAILED
OPERATION_FAILED
Error message
OPERATION_FAILED
What it means
OPERATION_FAILED is the generic catch-all business error thrown when cleaning expired notifications fails unexpectedly. In NotificationServiceImpl.cleanExpiredNotifications, any exception from the underlying notificationDataService.deleteExpiredNotifications call (typically a database failure) is caught, logged, and rethrown as BusinessException(ResponseEnum.OPERATION_FAILED), hiding the root cause from the API response.
Solutions
- Check service logs for 'Failed to clean expired notifications' to see the real exception
- Verify database connectivity and that the notification table is writable
- Retry the cleanup operation after DB health is restored
- Increase DB timeout or batch the delete if the expired row count is very large
Example fix
// before
catch (Exception e) {
log.error("Failed to clean expired notifications", e);
throw new BusinessException(ResponseEnum.OPERATION_FAILED);
}
// after
catch (DataAccessException e) {
log.error("Failed to clean expired notifications", e);
throw new BusinessException(ResponseEnum.OPERATION_FAILED, "cleanup temporarily unavailable, retry later");
} Defensive patterns
Strategy: try-catch
Validate before calling
boolean dbHealthy = dataSourceHealthCheck.isUp(); // skip/defer cleanup if false
Try / catch
try {
notificationService.cleanExpiredNotifications();
} catch (BusinessException e) {
if ("OPERATION_FAILED".equals(e.getCode())) {
log.warn("notification cleanup failed, will retry next cycle");
scheduleRetry();
}
} Prevention
- Monitor DB health before running scheduled cleanup
- Batch large deletes to avoid long transactions
- Alert on the 'Failed to clean expired notifications' log line
When it happens
Trigger: Scheduled or manually triggered cleanup when the database connection is down, the notification table is locked, or the delete statement fails (constraint, timeout, deadlock).
Common situations: DB maintenance windows, connection pool exhaustion, slow queries timing out during bulk deletes of expired rows, replicas in read-only mode.
Related errors
- CREATE_BOT_FAILED
- UPDATE_BOT_FAILED
- NOTIFICATION_MARK_READ_FAILED
- NOTIFICATION_DELETE_FAILED
- SYSTEM_ERROR
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/84ddcc76c44b8df2.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/notification/impl/NotificationServiceImpl.java:151
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);
}
}
// ==================== Internal Methods ====================
/**
* Broadcast notification internal processing method
*/
private Long sendBroadcastNotificationInternal(@Valid SendNotificationRequest request) {
// Create broadcast notification
Notification notification = createNotificationEntity(request, NotificationType.BROADCAST);
notification = notificationDataService.createNotification(notification);
log.info("Broadcast notification sent successfully, notificationId: {}", notification.getId());
return notification.getId();
}
/**View on GitHub (pinned to 5e758547a8)