iflytek/astron-agent · warning

Please enter chat content

Error message

Please enter chat content

What it means

The chat message endpoint requires non-blank message text. When the text field is null, empty, or whitespace-only, validateChatRequest sends 'Please enter chat content' over the SSE emitter and closes the stream. It prevents dispatching empty user turns to the agent engine.

Solutions

  1. Guard in the UI: disable send until trimmed text length > 0
  2. Trim and validate message text client-side before opening the SSE request
  3. If sending attachments-only turns, use the appropriate endpoint rather than blank text

Example fix

// before
const content = editor.getText();
send(content);
// after
const content = editor.getText().trim();
if (!content) return; // do not call send
send(content);
Defensive patterns

Strategy: validation

Validate before calling

if (!text || text.trim().length === 0) return; // skip send

Type guard

function hasContent(s) { return typeof s === 'string' && s.trim().length > 0; }

Prevention

When it happens

Trigger: Calling the chat message send endpoint with text that is null, "", or only whitespace (StrUtil.isBlank(text)).

Common situations: User presses enter on an empty input box; frontend trims/strips content accidentally (e.g. markdown-only content removed); paste of only whitespace; form state not synchronized before submit.

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/9bc58375fe4ca362. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/controller/chat/ChatMessageController.java:136

     * Validate the validity of chat request
     *
     * @param chatId Chat room ID, may be null
     * @param text Chat text content, may be null or blank
     * @param sseId Server-sent events ID, identifies current connection
     * @param sseEmitter Server-sent events emitter, used to send messages to client
     * @return Returns valid result if validation passes, otherwise returns invalid result
     */
    private ValidationResult validateChatRequest(Long chatId, String text, String sseId, SseEmitter sseEmitter) {
        if (chatId == null) {
            log.warn("chatId is empty, sseId: {}", sseId);
            SseEmitterUtil.sendError(sseEmitter, "Chat ID cannot be empty");
            SseEmitterUtil.sendEndAndComplete(sseEmitter);
            return ValidationResult.invalid();
        }

        if (StrUtil.isBlank(text)) {
            log.warn("Chat content is empty, sseId: {}, chatId: {}", sseId, chatId);
            SseEmitterUtil.sendError(sseEmitter, "Please enter chat content");
            SseEmitterUtil.sendEndAndComplete(sseEmitter);
            return ValidationResult.invalid();
        }

        return ValidationResult.valid();
    }

    /**
     * Validate chat context
     *
     * @param chatId Chat ID
     * @param sseId Server-sent events ID
     * @param sseEmitter Server-sent events emitter
     * @return Valid chat context or null
     */
    private ChatContext validateChatContext(Long chatId, Long requestId, String sseId, SseEmitter sseEmitter) {
        String uid = RequestContextUtil.getUID();

View on GitHub (pinned to 5e758547a8)