{"record":{"id":"a47c6d61fb6d8a85","repo":"iflytek/astron-agent","slug":"parameter-error","errorCode":"PARAMETER_ERROR","errorMessage":"PARAMETER_ERROR","messagePattern":"PARAMETER_ERROR","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"warning","filePath":"console/backend/commons/src/main/java/com/iflytek/astron/console/commons/service/workflow/impl/WorkflowBotChatServiceImpl.java","lineNumber":116,"sourceCode":"     *\n     * @param chatBotReqDto Chat bot request data transfer object\n     * @param sseEmitter Server-Sent Events emitter\n     * @param sseId Server-sent event identifier\n     * @param workflowOperation Workflow operation type\n     * @param workflowVersion Workflow version\n     */\n    @Override\n    public void chatWorkflowBot(ChatBotReqDto chatBotReqDto, SseEmitter sseEmitter, String sseId, String workflowOperation, String workflowVersion) {\n        String uid = chatBotReqDto.getUid();\n        Long chatId = chatBotReqDto.getChatId();\n        String ask = chatBotReqDto.getAsk();\n        String url = chatBotReqDto.getUrl();\n        Integer botId = chatBotReqDto.getBotId();\n\n        if (StrUtil.isBlank(ask)) {\n            log.warn(\"Rejecting workflow chat request with empty user input, uid: {}, chatId: {}, botId: {}\",\n                    uid, chatId, botId);\n            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);\n        }\n\n        JSONObject inputs = new JSONObject();\n        inputs.put(\"AGENT_USER_INPUT\", ask);\n\n        UserLangChainInfo userLangChainInfo = userLangChainDataService.findOneByBotId(botId);\n        if (userLangChainInfo == null) {\n            throw new BusinessException(ResponseEnum.BOT_CHAIN_SUBMIT_ERROR);\n        }\n        String flowId = userLangChainInfo.getFlowId();\n        String effectiveWorkflowVersion = resolveWorkflowVersion(botId, flowId, workflowVersion);\n        // Record current question\n        ChatReqRecords chatReqRecords = new ChatReqRecords();\n        chatReqRecords.setChatId(chatId);\n        chatReqRecords.setUid(uid);\n        chatReqRecords.setMessage(ask);\n        chatReqRecords.setClientType(0);\n        chatReqRecords.setCreateTime(LocalDateTime.now());","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/commons/src/main/java/com/iflytek/astron/console/commons/service/workflow/impl/WorkflowBotChatServiceImpl.java#L98-L134","documentation":"BusinessException with code PARAMETER_ERROR thrown by chatWorkflowBot when the user's ask (AGENT_USER_INPUT) is blank (StrUtil.isBlank). The service rejects empty chat input before invoking the workflow, since an empty prompt cannot drive the agent.","triggerScenarios":"POSTing to the workflow bot chat endpoint with ask = \"\", whitespace-only, or null; clients that send empty messages on enter-key presses or retry after a failed send with a cleared input.","commonSituations":"Frontend bug submitting empty text boxes; whitespace-only input from copy-paste; automated scripts sending placeholder empty payloads; localized input where only invisible characters were typed.","solutions":["Ensure the ask field contains non-empty, non-whitespace text before calling the chat endpoint.","Trim input client-side and block submission when trimmed length is 0.","If whitespace-only input should be valid, pre-normalize it into meaningful text rather than sending raw whitespace.","Fix client code that re-submits the last (now empty) input on retry."],"exampleFix":"// before\nawait chat({ botId, ask: input.value });\n// after\nconst ask = input.value.trim();\nif (!ask) { showWarning('Please enter a message'); return; }\nawait chat({ botId, ask });","handlingStrategy":"validation","validationCode":"const ask = (raw ?? '').trim();\nif (!ask) throw new Error('Message cannot be empty');","typeGuard":"function hasMeaningfulInput(s) { return typeof s === 'string' && s.trim().length > 0; }","tryCatchPattern":"try { await chat({ botId, ask }); } catch (e) { if (e.code === 'PARAMETER_ERROR') { focusInputAndWarnUser(); } else throw e; }","preventionTips":["Trim and verify input before submit","Disable send button when input is empty","Guard enter-key handlers against empty payloads","Normalize whitespace-only paste content"],"tags":["validation","empty-input","request","java"],"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"}