iflytek/astron-agent · error · BusinessException
DATA_NOT_FOUND
DATA_NOT_FOUND
Error message
ResponseEnum.DATA_NOT_FOUND
What it means
DATA_NOT_FOUND thrown by findAccessibleSession when the debug session belongs to a different space than the request's spaceId. Sessions are hidden (not forbidden) across spaces, so the mismatch surfaces as not-found.
Solutions
- Refresh the session list in the current space and use a valid sessionId
- Ensure the client sends the same spaceId under which the session was created
- Recreate the debug session if it belongs to the old space
- Verify UI switches/clears debug sessions when the space changes
Example fix
// before getMessages(sessionId, oldSpaceId); // after const sessions = await listSessions(currentSpaceId); if (sessions.some(s => s.id === sessionId)) getMessages(sessionId, currentSpaceId);
Defensive patterns
Strategy: try-catch
Validate before calling
const exists = (await listSessions(currentSpaceId)).some(s => s.id === sessionId); if (!exists) recreateSession();
Try / catch
try { await getMessages(sessionId, spaceId); } catch (e) { if (e.code === 'DATA_NOT_FOUND') resetDebugSession(); } Prevention
- Clear open debug sessions on space switch
- Store sessionId together with its spaceId
- Treat cross-space ids as not-found by design
When it happens
Trigger: Calling getMessages or update on a sessionId whose AgentDebugSession.spaceId differs from the current spaceId — e.g. stale client cache or cross-space lookup.
Common situations: User switched space while a debug session from the old space is open in the UI; bookmarked session id from another space; data migrated between spaces.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/41d00ba953c19d48.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/agentdebug/impl/AgentDebugServiceImpl.java:162
sessionMapper.update(update, updateWrapper);
}
private void validateUser(String uid) {
if (StringUtils.isBlank(uid)) {
throw new BusinessException(ResponseEnum.UNAUTHORIZED);
}
}
private void checkBotPermission(String uid, Long spaceId, Integer botId) {
if (botId == null || chatBotBaseMapper.checkBotPermission(botId, uid, spaceId) <= 0) {
throw new BusinessException(ResponseEnum.INSUFFICIENT_PERMISSIONS);
}
}
private AgentDebugSession findAccessibleSession(String uid, Long spaceId, String sessionId) {
AgentDebugSession session = findSession(uid, sessionId);
if (!isSameSpace(session.getSpaceId(), spaceId)) {
throw new BusinessException(ResponseEnum.DATA_NOT_FOUND);
}
checkBotPermission(uid, spaceId, session.getBotId());
return session;
}
private boolean isSameSpace(Long sessionSpaceId, Long currentSpaceId) {
if (sessionSpaceId == null || currentSpaceId == null) {
return sessionSpaceId == null && currentSpaceId == null;
}
return sessionSpaceId.equals(currentSpaceId);
}
private void addSpaceCondition(LambdaQueryWrapper<AgentDebugSession> queryWrapper, Long spaceId) {
if (spaceId == null) {
queryWrapper.isNull(AgentDebugSession::getSpaceId);
} else {
queryWrapper.eq(AgentDebugSession::getSpaceId, spaceId);
}View on GitHub (pinned to 5e758547a8)