iflytek/astron-agent · warning · BusinessException

PARAMETER_ERROR

PARAMETER_ERROR

Error message

PARAMETER_ERROR

What it means

sendNotification requires a non-null request with a non-null type field. If the request body is missing entirely or SendNotificationRequest.type is null (no NotificationType supplied), it throws BusinessException(ResponseEnum.PARAMETER_ERROR), rejecting the call before routing to type-specific handling.

Solutions

  1. Include a valid type value (BROADCAST, PERSONAL, SYSTEM, or PROMOTION) in the request body.
  2. Check the JSON key spelling matches the DTO field 'type'.
  3. Add client-side null checks before invoking sendNotification.

Example fix

// before
{"title":"Sale","content":"50% off"}
// after
{"type":"PROMOTION","title":"Sale","content":"50% off"}
Defensive patterns

Strategy: validation

Validate before calling

if (!req || !req.type) { throw new Error('sendNotification requires a non-null type'); }

Type guard

function isSendable(r) { return r != null && r.type != null; }

Try / catch

try { sendNotification(req); } catch (BusinessException e) { if (e.getCode() == ResponseEnum.PARAMETER_ERROR.getCode()) { /* fix payload */ } }

Prevention

When it happens

Trigger: POSTing a notification payload without the 'type' field; deserializing JSON where the type key is misspelled (e.g. 'notificationType') leaving the field null; calling the service programmatically with a null or unpopulated SendNotificationRequest.

Common situations: API consumers omitting required fields; enum name mismatches between client and server causing failed binding; older clients not updated for the type field.

Related errors


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

Appendix: source

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

@Slf4j
@Service
@RequiredArgsConstructor
public class NotificationServiceImpl implements NotificationService {

    private final NotificationDataService notificationDataService;

    // Batch operation limit constants
    private static final int MAX_BATCH_SIZE = 1000;
    private static final int MAX_NOTIFICATION_IDS = 100;

    // ==================== Send Notification ====================

    @Override
    @Transactional
    public Long sendNotification(SendNotificationRequest request) {
        // Parameter validation
        if (request == null || request.getType() == null) {
            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);
        }

        NotificationType notificationType = request.getType();

        // Route to different processing logic based on message type
        switch (notificationType) {
            case BROADCAST:
                return sendBroadcastNotificationInternal(request);
            case PERSONAL, SYSTEM, PROMOTION:
                return sendToUsersNotificationInternal(request, notificationType);
            default:
                throw new BusinessException(ResponseEnum.NOTIFICATION_TYPE_INVALID);
        }
    }

    // ==================== Query Notification ====================

    @Override

View on GitHub (pinned to 5e758547a8)