{"record":{"id":"84ddcc76c44b8df2","repo":"iflytek/astron-agent","slug":"operation-failed-84ddcc","errorCode":"OPERATION_FAILED","errorMessage":"OPERATION_FAILED","messagePattern":"OPERATION_FAILED","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/notification/impl/NotificationServiceImpl.java","lineNumber":151,"sourceCode":"            log.error(\"Failed to delete notification, receiverUid: {}, notificationId: {}\",\n                    receiverUid, notificationId, e);\n            throw new BusinessException(ResponseEnum.NOTIFICATION_DELETE_FAILED);\n        }\n    }\n\n    // ==================== System Management ====================\n\n    @Override\n    @Transactional\n    public int cleanExpiredNotifications() {\n        try {\n            LocalDateTime expireTime = LocalDateTime.now();\n            int deleted = notificationDataService.deleteExpiredNotifications(expireTime);\n            log.info(\"Expired notifications cleaned, count: {}\", deleted);\n            return deleted;\n        } catch (Exception e) {\n            log.error(\"Failed to clean expired notifications\", e);\n            throw new BusinessException(ResponseEnum.OPERATION_FAILED);\n        }\n    }\n\n    // ==================== Internal Methods ====================\n\n    /**\n     * Broadcast notification internal processing method\n     */\n    private Long sendBroadcastNotificationInternal(@Valid SendNotificationRequest request) {\n        // Create broadcast notification\n        Notification notification = createNotificationEntity(request, NotificationType.BROADCAST);\n        notification = notificationDataService.createNotification(notification);\n\n        log.info(\"Broadcast notification sent successfully, notificationId: {}\", notification.getId());\n        return notification.getId();\n    }\n\n    /**","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/notification/impl/NotificationServiceImpl.java#L133-L169","documentation":"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.","triggerScenarios":"Scheduled or manually triggered cleanup when the database connection is down, the notification table is locked, or the delete statement fails (constraint, timeout, deadlock).","commonSituations":"DB maintenance windows, connection pool exhaustion, slow queries timing out during bulk deletes of expired rows, replicas in read-only mode.","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"],"exampleFix":"// before\ncatch (Exception e) {\n    log.error(\"Failed to clean expired notifications\", e);\n    throw new BusinessException(ResponseEnum.OPERATION_FAILED);\n}\n// after\ncatch (DataAccessException e) {\n    log.error(\"Failed to clean expired notifications\", e);\n    throw new BusinessException(ResponseEnum.OPERATION_FAILED, \"cleanup temporarily unavailable, retry later\");\n}","handlingStrategy":"try-catch","validationCode":"boolean dbHealthy = dataSourceHealthCheck.isUp(); // skip/defer cleanup if false","typeGuard":null,"tryCatchPattern":"try {\n    notificationService.cleanExpiredNotifications();\n} catch (BusinessException e) {\n    if (\"OPERATION_FAILED\".equals(e.getCode())) {\n        log.warn(\"notification cleanup failed, will retry next cycle\");\n        scheduleRetry();\n    }\n}","preventionTips":["Monitor DB health before running scheduled cleanup","Batch large deletes to avoid long transactions","Alert on the 'Failed to clean expired notifications' log line"],"tags":["database","cleanup","scheduled-task"],"backgroundTag":"database-write-failed","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}