iflytek/astron-agent · error · BusinessException
BOT_NOT_EXISTS
BOT_NOT_EXISTS
Error message
BOT_NOT_EXISTS
What it means
BOT_NOT_EXISTS in getBotDetail means selectBotDetail returned no row for the given botId with the caller's uid and spaceId. The mapper query doubles as permission validation, so null means the bot does not exist OR the user/space has no access — the error intentionally conflates the two to avoid leaking existence.
Solutions
- Verify botId exists and is not deleted
- Confirm the request carries the correct spaceId and that the bot belongs to it
- Check that the current uid has owner/collaborator permission on the bot
- Refresh the bot list and retry with a valid id
Example fix
// before
const detail = await api.getBotDetail(botIdFromUrl, uid, staleSpaceId);
// after
const detail = await api.getBotDetail(botIdFromUrl, uid, currentSpaceId);
if (!detail) showToast("bot not found in this space"); Defensive patterns
Strategy: try-catch
Validate before calling
const bots = await api.listBots(uid, spaceId);
if (!bots.some(b => b.id === botId)) return showError("bot not available in this space"); Type guard
function isAccessibleBot(bots, botId) {
return Array.isArray(bots) && bots.some(b => b.id === botId);
} Try / catch
try {
const detail = await api.getBotDetail(botId, uid, spaceId);
} catch (e) {
if (e.code === "BOT_NOT_EXISTS") {
redirectToBotList("bot not found or inaccessible");
}
} Prevention
- Refresh bot ids when switching spaces
- Check bot existence in the space before deep-linking
- Handle deleted bots gracefully in cached UI state
When it happens
Trigger: Querying bot detail with a wrong/deleted botId, a bot that belongs to a different space, or a uid that is not an owner/collaborator of the bot.
Common situations: Stale frontend cache pointing at a deleted bot, switching spaces while an old botId is in the URL, or a user sharing a link to a bot they lack permission for.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/318d784fa9f3fb16.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/BotPublishServiceImpl.java:126
List<BotPublishInfoDto> botList = botPublishConverter.queryResultsToDtoList(queryResult.getRecords());
// 4. Build response result
return PageResponse.of(
requestDto.getPage(),
requestDto.getSize(),
queryResult.getTotal(),
botList);
}
@Override
public BotDetailResponseDto getBotDetail(Integer botId, String currentUid, Long spaceId) {
log.info("Query bot details: botId={}, uid={}, spaceId={}", botId, currentUid, spaceId);
// 1. Permission validation and query bot basic information
BotPublishQueryResult queryResult = chatBotMarketMapper.selectBotDetail(botId, currentUid, spaceId);
if (queryResult == null) {
throw new BusinessException(ResponseEnum.BOT_NOT_EXISTS);
}
// 2. Basic information conversion (including publish channel parsing)
BotDetailResponseDto detailDto = botPublishConverter.queryResultToDetailDto(queryResult);
// 3. Get WeChat binding information (only query when published to WeChat)
if (detailDto.getPublishChannels().contains(PublishChannelEnum.WECHAT.getCode())) {
String[] wechatInfo = publishChannelService.getWechatInfo(currentUid, botId);
detailDto.setWechatRelease(Integer.valueOf(wechatInfo[0]));
detailDto.setWechatAppid(wechatInfo[1]);
} else {
detailDto.setWechatRelease(0);
detailDto.setWechatAppid(null);
}
// 4. Get MaaS App ID
String maasId = getMaasIdByBotId(botId);
detailDto.setMaasId(maasId);View on GitHub (pinned to 5e758547a8)