{"record":{"id":"e549361a2c98d423","repo":"iflytek/astron-agent","slug":"parameter-error-e54936","errorCode":"PARAMETER_ERROR","errorMessage":"PARAMETER_ERROR","messagePattern":"PARAMETER_ERROR","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":43,"sourceCode":"@Slf4j\n@Service\n@RequiredArgsConstructor\npublic class NotificationServiceImpl implements NotificationService {\n\n    private final NotificationDataService notificationDataService;\n\n    // Batch operation limit constants\n    private static final int MAX_BATCH_SIZE = 1000;\n    private static final int MAX_NOTIFICATION_IDS = 100;\n\n    // ==================== Send Notification ====================\n\n    @Override\n    @Transactional\n    public Long sendNotification(SendNotificationRequest request) {\n        // Parameter validation\n        if (request == null || request.getType() == null) {\n            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);\n        }\n\n        NotificationType notificationType = request.getType();\n\n        // Route to different processing logic based on message type\n        switch (notificationType) {\n            case BROADCAST:\n                return sendBroadcastNotificationInternal(request);\n            case PERSONAL, SYSTEM, PROMOTION:\n                return sendToUsersNotificationInternal(request, notificationType);\n            default:\n                throw new BusinessException(ResponseEnum.NOTIFICATION_TYPE_INVALID);\n        }\n    }\n\n    // ==================== Query Notification ====================\n\n    @Override","sourceCodeStart":25,"sourceCodeEnd":61,"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#L25-L61","documentation":"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.","triggerScenarios":"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.","commonSituations":"API consumers omitting required fields; enum name mismatches between client and server causing failed binding; older clients not updated for the type field.","solutions":["Include a valid type value (BROADCAST, PERSONAL, SYSTEM, or PROMOTION) in the request body.","Check the JSON key spelling matches the DTO field 'type'.","Add client-side null checks before invoking sendNotification."],"exampleFix":"// before\n{\"title\":\"Sale\",\"content\":\"50% off\"}\n// after\n{\"type\":\"PROMOTION\",\"title\":\"Sale\",\"content\":\"50% off\"}","handlingStrategy":"validation","validationCode":"if (!req || !req.type) { throw new Error('sendNotification requires a non-null type'); }","typeGuard":"function isSendable(r) { return r != null && r.type != null; }","tryCatchPattern":"try { sendNotification(req); } catch (BusinessException e) { if (e.getCode() == ResponseEnum.PARAMETER_ERROR.getCode()) { /* fix payload */ } }","preventionTips":["Define a typed request builder that requires type.","Validate payloads against the DTO schema before sending.","Keep client/server enum and field names in sync."],"tags":["validation","notification"],"backgroundTag":"null-argument","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"}