iflytek/astron-agent · error
CHAT_REQ_NOT_BELONG_ERROR
CHAT_REQ_NOT_BELONG_ERROR
Error message
CHAT_REQ_NOT_BELONG_ERROR
What it means
In TalkAgentServiceImpl.saveHistory, after resolving the latest chat node, the code looks up ChatList by uid and lastChatId. If no record is found it returns ResponseEnum.CHAT_REQ_NOT_BELONG_ERROR, meaning the chat either does not exist or does not belong to the requesting user (uid/chatId mismatch). This is a fail-closed ownership check against illegal access.
Solutions
- Verify the authenticated uid matches the owner of the chatId before sending the request.
- Re-login/refresh the session if the token belongs to a different account than the UI expects.
- Reload the conversation list on the client and use a valid chatId.
- Check for double-login/account-switch flows that stale the uid-chatId pairing.
Defensive patterns
Strategy: validation
Validate before calling
// client-side guard: only send chatIds owned by the logged-in user
if (chat.ownerUid !== currentUser.uid) { showError('Conversation does not belong to current user'); return; } Try / catch
ResponseEnum result = talkAgentService.saveHistory(req);
if (result == ResponseEnum.CHAT_REQ_NOT_BELONG_ERROR) {
clearStaleConversationCache();
reloadConversationList();
} Prevention
- Clear cached chatIds on account switch/logout.
- Never trust chatId from URL params without ownership verification server-side (already enforced).
- Re-fetch conversation list after multi-tab deletions.
- Include ownership checks in integration tests.
When it happens
Trigger: findByUidAndChatId(uid, lastChatId) returns null: the chatId exists for another user, was deleted, or the uid in the request does not match the chat's owner.
Common situations: User A sends a chatId belonging to user B (shared links, tampered request); session token for a different account than the one that owns the chat; chat deleted in another tab while the client still posts to it.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
- MODEL_CHECK_FAILED
- EXCEED_AUTHORITY
- EXCEED_AUTHORITY
- EXCEED_AUTHORITY
- Current conversation window is unavailable
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/a868816d51cb9583.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/bot/impl/TalkAgentServiceImpl.java:86
String req = talkAgentHistoryDto.getReq();
String resp = talkAgentHistoryDto.getResp();
String sid = talkAgentHistoryDto.getSid();
if (chatId == null) {
return ResponseEnum.CHAT_REQ_ERROR;
}
// get latest chatId
List<ChatTreeIndex> chatTreeIndexList = chatListDataService.findChatTreeIndexByChatIdOrderById(chatId);
if (chatTreeIndexList.isEmpty()) {
log.warn("chatTreeList is empty, chatId:{}, sid:{}", chatId, sid);
return ResponseEnum.CHAT_REQ_ERROR;
}
Long lastChatId = chatTreeIndexList.getFirst().getChildChatId();
// check chatId available
ChatList chatList = chatListDataService.findByUidAndChatId(uid, lastChatId);
if (chatList == null) {
log.warn("Chat window is unavailable or illegal access,uid: {}, chatId: {}", uid, chatId);
return ResponseEnum.CHAT_REQ_NOT_BELONG_ERROR;
}
// record request
chatId = lastChatId;
ChatReqRecords chatReqRecords = new ChatReqRecords();
chatReqRecords.setChatId(chatId);
chatReqRecords.setUid(uid);
chatReqRecords.setMessage(req);
chatReqRecords.setClientType(clientType);
chatReqRecords.setCreateTime(LocalDateTime.now());
chatReqRecords.setUpdateTime(LocalDateTime.now());
chatReqRecords.setNewContext(1);
chatReqRecords = chatDataService.createRequest(chatReqRecords);
Long reqId = chatReqRecords.getId();
// record response
ChatRespRecords chatRespRecords = new ChatRespRecords();
chatRespRecords.setChatId(chatId);
chatRespRecords.setUid(uid);
chatRespRecords.setMessage(resp);View on GitHub (pinned to 5e758547a8)