iflytek/astron-agent · error · BusinessException
BOT_NOT_EXISTS
BOT_NOT_EXISTS
Error message
BOT_NOT_EXISTS
What it means
BOT_NOT_EXISTS is thrown by PublishApiServiceImpl.getApiInfo when no ChatBotBase row exists for the current user's uid and the given botId. It means the requested bot does not exist or is not visible/owned by the requesting user.
Solutions
- Verify the bot exists for the current uid (chatBotDataService.findOne(uid, botId)).
- Refresh the client's bot list and use a valid botId.
- Ensure the request's auth context resolves to the bot owner's uid.
- Re-create the bot if it was deleted.
Example fix
// before (caller blindly calls)
BotApiInfoDTO info = publishApiService.getApiInfo(botId);
// after (caller validates first)
ChatBotBase bot = chatBotDataService.findOne(uid, botId);
if (bot != null) {
BotApiInfoDTO info = publishApiService.getApiInfo(botId);
} else {
// handle missing bot in UI
} Defensive patterns
Strategy: validation
Validate before calling
if (chatBotDataService.findOne(uid, botId) == null) {
// bot missing; abort before calling getApiInfo
return;
}
publishApiService.getApiInfo(botId); Type guard
boolean botExists(String uid, Long botId) {
return Objects.nonNull(chatBotDataService.findOne(uid, botId));
} Try / catch
try {
BotApiInfoDTO info = publishApiService.getApiInfo(botId);
} catch (BusinessException e) {
if ("BOT_NOT_EXISTS".equals(String.valueOf(e.getCode()))) {
// show 'bot not found', refresh bot list
}
} Prevention
- Refresh bot lists after deletes instead of caching botIds.
- Always use the uid of the authenticated user.
- Validate botId ownership before deep-linking users into bot pages.
When it happens
Trigger: Calling getApiInfo with a botId that has no chat_bot_base row for the authenticated uid (deleted bot, wrong uid, botId from another account/space).
Common situations: Stale frontend links to a deleted bot; calling with a botId copied from another environment; token belongs to a different user than the bot owner.
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/4310c64aac9a228e.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/PublishApiServiceImpl.java:168
throw new BusinessException(ResponseEnum.BOT_TYPE_NOT_SUPPORT);
}
} catch (BusinessException e) {
throw e;
} catch (Exception e) {
log.error("PublishApiServiceImpl.createBotApi : create Bot api error, request: {}", createBotApiVo, e);
throw new BusinessException(ResponseEnum.BOT_API_CREATE_ERROR);
} finally {
redisUtil.unlock(PUBLISH_API + uid, uuid);
}
}
@Override
public BotApiInfoDTO getApiInfo(Long botId) {
String uid = RequestContextUtil.getUID();
ChatBotBase botBase = chatBotDataService.findOne(uid, botId);
if (Objects.isNull(botBase)) {
throw new BusinessException(ResponseEnum.BOT_NOT_EXISTS);
}
ChatBotApi botApi = chatBotApiService.getOneByUidAndBotId(uid, botId);
if (Objects.isNull(botApi)) {
return new BotApiInfoDTO();
}
AppMst appMst = appMstService.getByAppId(uid, botApi.getAppId());
if (Objects.isNull(appMst)) {
throw new BusinessException(ResponseEnum.USER_APP_ID_NOT_EXISTE);
}
String serviceUrlHost = botBase.getVersion() == 1 ? botApiCbmBaseUrl : botApiMaasBaseUrl;
return BotApiInfoDTO.builder()
.botId(Math.toIntExact(botId))
.botName(botBase.getBotName())
.appName(appMst.getAppName())
.appId(appMst.getAppId())
.appKey(appMst.getAppKey())
.appSecret(appMst.getAppSecret())
.serviceUrl(serviceUrlHost + botApi.getApiPath())View on GitHub (pinned to 5e758547a8)