iflytek/astron-agent · error · BusinessException
PARAMS_ERROR
PARAMS_ERROR
Error message
PARAMS_ERROR
What it means
PARAMS_ERROR is a generic client-input validation failure thrown by the chat message controller's clear() endpoint. It fires when the caller's chatId is null, meaning the request did not identify which chat list to clear. The backend refuses to proceed rather than guessing a chat.
Solutions
- Ensure the client sends chatId in the request before calling clear
- Check the calling code obtains chatId from the chat creation/list API response
- Log the request payload and verify JSON field name matches (chatId, not chat_id)
- Guard in UI: disable 'clear chat' until a chat exists
Example fix
// before
await api.post('/chat/clear', { botId });
// after
if (!chatId) throw new Error('chatId required');
await api.post('/chat/clear', { botId, chatId }); Defensive patterns
Strategy: validation
Validate before calling
if (chatId == null) throw new IllegalArgumentException('chatId is required'); Type guard
if (typeof chatId === 'number' && chatId > 0) { /* safe to call */ } Try / catch
try { await clearChat(botId, chatId); } catch (e) { if (e.code === 'PARAMS_ERROR') refreshChatState(); } Prevention
- Never call clear before chat creation completes
- Validate required params client-side
- Keep chatId in a single source of truth (store)
When it happens
Trigger: Calling the clear endpoint (ChatMessageController.clear) with request params missing chatId, or a client serializing chatId as null after a failed chat creation.
Common situations: Frontend clears a conversation before the chat list was created (chatId not yet assigned); stale UI state pointing at a deleted/never-created chat; API consumers calling the endpoint directly without chatId.
Related errors
- LONG_CONTENT_CHAT_ID_ERROR
- LONG_CONTENT_MISS_FILE_INFO
- PARAMETER_ERROR
- LONG_CONTENT_WRONG_BUSINESS_TYPE
- LONG_CONTENT_MISS_FILE_INFO
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/6f7bb353789ee101.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/controller/chat/ChatMessageController.java:459
} catch (Exception e) {
log.error("Bot debug error, sseId: {}", sseId, e);
SseEmitterUtil.completeWithError(sseEmitter, "Chat service exception: " + e.getMessage());
return sseEmitter;
}
}
/**
* Clear chat history
*/
@GetMapping(path = "/clear")
@Operation(summary = "Clear chat history")
public ApiResult<ChatListCreateResponse> clear(Integer botId, Long chatId) {
String uid = RequestContextUtil.getUID();
if (uid == null) {
throw new BusinessException(ResponseEnum.LOGIN_INFO_ERROR);
}
if (chatId == null) {
throw new BusinessException(ResponseEnum.PARAMS_ERROR);
}
ChatBotBase botBase = chatBotDataService.findById(botId).orElse(null);
if (botBase == null) {
throw new BusinessException(ResponseEnum.PARAMS_ERROR);
}
return ApiResult.success(botChatService.clear(chatId, uid, botId, botBase));
}
}
View on GitHub (pinned to 5e758547a8)