{"record":{"id":"1c8fbcd98725125a","repo":"iflytek/astron-agent","slug":"notification-receiver-empty","errorCode":"NOTIFICATION_RECEIVER_EMPTY","errorMessage":"NOTIFICATION_RECEIVER_EMPTY","messagePattern":"NOTIFICATION_RECEIVER_EMPTY","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"warning","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/notification/impl/NotificationServiceImpl.java","lineNumber":174,"sourceCode":"\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    /**\n     * Internal processing method for sending notifications to specified user list\n     */\n    private Long sendToUsersNotificationInternal(@Valid SendNotificationRequest request, NotificationType type) {\n        if (CollectionUtils.isEmpty(request.getReceiverUids())) {\n            throw new BusinessException(ResponseEnum.NOTIFICATION_RECEIVER_EMPTY);\n        }\n\n        // Validate the recipient quantity limit for batch sending\n        if (request.getReceiverUids().size() > MAX_BATCH_SIZE) {\n            throw new BusinessException(ResponseEnum.PARAMETER_ERROR,\n                    String.format(\"Number of receivers cannot exceed %d\", MAX_BATCH_SIZE));\n        }\n\n        return sendNotificationToUsers(request, type, request.getReceiverUids());\n    }\n\n    /**\n     * Unified method for sending notifications to users\n     */\n    private Long sendNotificationToUsers(SendNotificationRequest request, NotificationType type, List<String> receiverUids) {\n        // Create notification\n        Notification notification = createNotificationEntity(request, type);\n        notification = notificationDataService.createNotification(notification);","sourceCodeStart":156,"sourceCodeEnd":192,"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#L156-L192","documentation":"NOTIFICATION_RECEIVER_EMPTY indicates a send-notification request was made with an empty or missing receiverUids list. The internal send path sendToUsersNotificationInternal requires at least one recipient and fails fast before any persistence or delivery work.","triggerScenarios":"Calling sendNotification with a SendNotificationRequest whose receiverUids is null or an empty collection.","commonSituations":"Frontend sends no selected users, a filter on the user list yielded zero results, or the request body omitted the field so it deserialized to null.","solutions":["Populate receiverUids with at least one valid UID before calling the send API","Add a frontend check that disables the send button until at least one recipient is selected","Return a clearer client-side error instead of relying on the server-side empty check"],"exampleFix":"// before\nnotificationService.sendNotification(request); // receiverUids: []\n// after\nif (request.getReceiverUids() == null || request.getReceiverUids().isEmpty()) {\n    throw new IllegalArgumentException(\"at least one receiver uid is required\");\n}\nnotificationService.sendNotification(request);","handlingStrategy":"validation","validationCode":"if (request.getReceiverUids() == null || request.getReceiverUids().isEmpty()) {\n    throw new IllegalArgumentException(\"receiverUids must contain at least one uid\");\n}","typeGuard":"static boolean hasReceivers(SendNotificationRequest r) {\n    return r.getReceiverUids() != null && !r.getReceiverUids().isEmpty();\n}","tryCatchPattern":null,"preventionTips":["Validate the recipient list in the UI before submit","Deduplicate and filter recipient lists server-side","Use @NotEmpty on receiverUids in the request DTO"],"tags":["validation","notification","empty-list"],"backgroundTag":"empty-required-field","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"}