iflytek/astron-agent · warning · BusinessException

NOTIFICATION_RECEIVER_EMPTY

NOTIFICATION_RECEIVER_EMPTY

Error message

NOTIFICATION_RECEIVER_EMPTY

What it means

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.

Solutions

  1. Populate receiverUids with at least one valid UID before calling the send API
  2. Add a frontend check that disables the send button until at least one recipient is selected
  3. Return a clearer client-side error instead of relying on the server-side empty check

Example fix

// before
notificationService.sendNotification(request); // receiverUids: []
// after
if (request.getReceiverUids() == null || request.getReceiverUids().isEmpty()) {
    throw new IllegalArgumentException("at least one receiver uid is required");
}
notificationService.sendNotification(request);
Defensive patterns

Strategy: validation

Validate before calling

if (request.getReceiverUids() == null || request.getReceiverUids().isEmpty()) {
    throw new IllegalArgumentException("receiverUids must contain at least one uid");
}

Type guard

static boolean hasReceivers(SendNotificationRequest r) {
    return r.getReceiverUids() != null && !r.getReceiverUids().isEmpty();
}

Prevention

When it happens

Trigger: Calling sendNotification with a SendNotificationRequest whose receiverUids is null or an empty collection.

Common situations: 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.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/1c8fbcd98725125a. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/notification/impl/NotificationServiceImpl.java:174

    /**
     * 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();
    }

    /**
     * Internal processing method for sending notifications to specified user list
     */
    private Long sendToUsersNotificationInternal(@Valid SendNotificationRequest request, NotificationType type) {
        if (CollectionUtils.isEmpty(request.getReceiverUids())) {
            throw new BusinessException(ResponseEnum.NOTIFICATION_RECEIVER_EMPTY);
        }

        // Validate the recipient quantity limit for batch sending
        if (request.getReceiverUids().size() > MAX_BATCH_SIZE) {
            throw new BusinessException(ResponseEnum.PARAMETER_ERROR,
                    String.format("Number of receivers cannot exceed %d", MAX_BATCH_SIZE));
        }

        return sendNotificationToUsers(request, type, request.getReceiverUids());
    }

    /**
     * Unified method for sending notifications to users
     */
    private Long sendNotificationToUsers(SendNotificationRequest request, NotificationType type, List<String> receiverUids) {
        // Create notification
        Notification notification = createNotificationEntity(request, type);
        notification = notificationDataService.createNotification(notification);

View on GitHub (pinned to 5e758547a8)