iflytek/astron-agent · warning · BusinessException
BOT_STATUS_NOT_ALLOW_PUBLISH
BOT_STATUS_NOT_ALLOW_PUBLISH
Error message
BOT_STATUS_NOT_ALLOW_PUBLISH
What it means
MarketPublishStrategy.publish allows re-publishing when a bot is already on shelf, but throws BOT_STATUS_NOT_ALLOW_PUBLISH when the bot's effective status is neither off-shelf nor on-shelf — i.e. an intermediate/invalid status (e.g. under review, blocked, or pending removal) forbids publishing. It is a status-guard before flipping the bot to ON_SHELF.
Solutions
- Check the bot's current publish status; complete or cancel the pending review before publishing.
- If the status is a stale/unknown value, correct the bot's status in the bot market table to OFF_SHELF and retry.
- Confirm ShelfStatusEnum covers every status value persisted by current code; add mappings if a status is missing.
- Retry after the moderation flow finishes rather than forcing a publish.
Example fix
// before
if (!isOffShelf(status) && !isOnShelf(status)) {
throw new BusinessException(ResponseEnum.BOT_STATUS_NOT_ALLOW_PUBLISH);
}
// after
if (ShelfStatusEnum.IN_REVIEW.getCode().equals(status)) {
throw new BusinessException(ResponseEnum.BOT_IN_REVIEW); // clearer error for this state
}
if (!isOffShelf(status) && !isOnShelf(status)) {
throw new BusinessException(ResponseEnum.BOT_STATUS_NOT_ALLOW_PUBLISH);
} Defensive patterns
Strategy: validation
Validate before calling
BotPublishQueryResult r = chatBotMarketMapper.selectBotDetail(botId, uid, spaceId);
Integer status = r != null ? r.getBotStatus() : null;
if (status != null && !ShelfStatusEnum.isOffShelf(status) && !ShelfStatusEnum.isOnShelf(status)) {
throw new IllegalStateException("bot status " + status + " (e.g. in review) does not allow publishing");
} Type guard
boolean isPublishableStatus(Integer status) {
return status != null && (ShelfStatusEnum.isOffShelf(status) || ShelfStatusEnum.isOnShelf(status));
} Try / catch
try {
marketPublishStrategy.publish(botId, uid, spaceId);
} catch (BusinessException e) {
if ("BOT_STATUS_NOT_ALLOW_PUBLISH".equals(e.getCode())) {
showStatus("bot is under review or blocked; resolve its current status first");
}
throw e;
} Prevention
- Check the bot's shelf status and finish pending review before publishing
- Ensure ShelfStatusEnum maps every status value the DB can contain
- Fix stuck status rows back to OFF_SHELF after failed publishes
When it happens
Trigger: publish() runs when effectiveStatus (from BotPublishQueryResult.getBotStatus(), possibly defaulted) is a value for which both ShelfStatusEnum.isOffShelf and ShelfStatusEnum.isOnShelf return false — e.g. status codes representing 'in review', 'rejected', or an unknown numeric status.
Common situations: Bot is stuck in a moderation/review state and the user clicks publish again; a status value was written by a newer/older code version that ShelfStatusEnum doesn't map; publishChannels/status row corrupted by a failed previous publish.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- BOT_NOT_EXISTS
- User UID cannot be null
- Timed out acquiring distributed lock, please try again later
- Current user does not exist
- Distributed lock acquisition timeout, please try again later
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/27e9dca5759d56b4.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/strategy/publish/impl/MarketPublishStrategy.java:66
if (hasPermission == 0) {
throw new BusinessException(ResponseEnum.BOT_NOT_EXISTS);
}
// 2. Query current publish status
BotPublishQueryResult queryResult = chatBotMarketMapper.selectBotDetail(botId, currentUid, spaceId);
Integer currentStatus = queryResult != null ? queryResult.getBotStatus() : null;
String currentChannels = queryResult != null ? queryResult.getPublishChannels() : null;
// 3. Calculate new status and channels
Integer effectiveStatus = currentStatus != null ? currentStatus : ShelfStatusEnum.OFF_SHELF.getCode();
// Allow re-publishing even if already on shelf
if (ShelfStatusEnum.isOnShelf(effectiveStatus)) {
log.info("Bot already published, performing re-publish operation: botId={}", botId);
}
if (!ShelfStatusEnum.isOffShelf(effectiveStatus) && !ShelfStatusEnum.isOnShelf(effectiveStatus)) {
throw new BusinessException(ResponseEnum.BOT_STATUS_NOT_ALLOW_PUBLISH);
}
Integer newStatus = ShelfStatusEnum.ON_SHELF.getCode();
String newChannels = publishChannelService.updatePublishChannels(
currentChannels, PublishChannelEnum.MARKET.getCode(), true);
// 4. Parse market-specific publish data
if (publishData != null) {
log.debug("Market publish data: {}", JSON.toJSONString(publishData));
// TODO: Parse market-specific data like category, tags, visibility settings
}
// 5. Handle market data synchronization directly
boolean isFirstPublish = currentStatus == null;
handleBotMarketSync(botId, currentUid, spaceId, newStatus, newChannels, isFirstPublish);
// 6. Publish event to trigger bot-type-specific operations (workflow version creation, etc.)
eventPublisher.publishEvent(new BotPublishStatusChangedEvent(View on GitHub (pinned to 5e758547a8)