{"record":{"id":"898ecde44e4cb894","repo":"iflytek/astron-agent","slug":"please-enter-chat-content-botchatserviceimpl","errorCode":null,"errorMessage":"Please enter chat content","messagePattern":"Please enter chat content","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/chat/impl/BotChatServiceImpl.java","lineNumber":133,"sourceCode":"\n    @Autowired\n    private AgentMemoryRuntimeService agentMemoryRuntimeService;\n\n    /**\n     * Function to handle chat messages\n     *\n     * @param chatBotReqDto Chat bot request data object\n     * @param sseEmitter Server-sent events emitter\n     * @param sseId Server-sent events ID\n     * @param workflowOperation Workflow operation\n     * @param workflowVersion Workflow version\n     */\n    @Override\n    public void chatMessageBot(ChatBotReqDto chatBotReqDto, SseEmitter sseEmitter, String sseId, String workflowOperation, String workflowVersion) {\n        try {\n            if (StrUtil.isBlank(chatBotReqDto.getAsk())) {\n                log.warn(\"Rejecting chat request with empty user input, sseId: {}, chatId: {}, uid: {}\",\n                        sseId, chatBotReqDto.getChatId(), chatBotReqDto.getUid());\n                SseEmitterUtil.completeWithError(sseEmitter, \"Please enter chat content\");\n                return;\n            }\n\n            log.info(\"Processing chat request, sseId: {}, chatId: {}, uid: {}\", sseId, chatBotReqDto.getChatId(), chatBotReqDto.getUid());\n            Long spaceId = SpaceInfoUtil.getSpaceId();\n\n            BotConfiguration botConfig = getBotConfiguration(chatBotReqDto.getBotId());\n            if (botConfig.version.equals(BotTypeEnum.WORKFLOW_BOT.getType()) || botConfig.version.equals(BotTypeEnum.TALK.getType())) {\n                syncWorkflowRuntimeModel(chatBotReqDto.getBotId(), botConfig, chatBotReqDto.getUid(), spaceId, sseEmitter);\n                workflowBotChatService.chatWorkflowBot(chatBotReqDto, sseEmitter, sseId, workflowOperation, workflowVersion);\n            } else {\n                ChatReqRecords chatReqRecords = createChatRequest(chatBotReqDto);\n                ModelConfigResult modelConfig = resolveChatModelConfiguration(\n                        botConfig.modelId, botConfig.model, chatBotReqDto.getUid(), spaceId, sseEmitter);\n                int maxInputTokens = modelConfig == null ? this.maxInputTokens : modelConfig.maxInputTokens();\n                List<SparkChatRequest.MessageDto> messages = buildMessageList(chatBotReqDto, botConfig.supportContext,\n                        botConfig.supportDocument, botConfig.prompt, maxInputTokens, chatReqRecords.getId());","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/chat/impl/BotChatServiceImpl.java#L115-L151","documentation":"BotChatServiceImpl.chatMessageBot rejects chat requests whose user input (ask) is blank. Instead of throwing, it completes the SSE emitter with an error whose message is \"Please enter chat content\". This is an input-validation guard preventing empty prompts from reaching the agent engine.","triggerScenarios":"chatMessageBot invoked with chatBotReqDto.getAsk() being null, empty string, or whitespace-only (StrUtil.isBlank).","commonSituations":"Frontend sends the chat request before the user typed anything (Enter on empty box); whitespace-only input; form submitted programmatically; message field serialization mismatch between client and DTO.","solutions":["Disable send / validate non-blank input in the UI before calling the chat API.","Trim and check the ask field client-side; show the validation message instead of opening an SSE stream.","If legitimate messages are rejected, verify the client serializes the message into the correct DTO field (ask)."],"exampleFix":"// before\nSseEmitterUtil.completeWithError(sseEmitter, \"Please enter chat content\");\n// after\n// client-side guard\nif (!ask || !ask.trim()) { showError('Please enter chat content'); return; }\nconst res = await api.chat({ ...body, ask: ask.trim() });","handlingStrategy":"validation","validationCode":"// before calling the chat API\nconst ask = (input ?? '').trim();\nif (!ask) { showWarning('Please enter chat content'); return; }\nawait chatApi.send({ ...body, ask });","typeGuard":"function hasContent(s) {\n  return typeof s === 'string' && s.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Disable the send button while the input is empty/whitespace.","Trim user input before submit.","Handle the SSE error event and show the message instead of a blank stream failure.","Ensure the message is serialized into the correct DTO field (ask)."],"tags":["validation","sse","empty-input","chat"],"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"}