iflytek/astron-agent · warning · BusinessException

USER_NO_APPROVEL

USER_NO_APPROVEL

Error message

USER_NO_APPROVEL

What it means

USER_NO_APPROVEL is thrown by validateMarketBotPermissions when a market bot is currently off-shelf (ShelfStatusEnum.isOffShelf) and the requesting uid is not the bot owner. Off-shelf market bots are only visible/usable to their owner, so other users are denied access to chat lists built on them.

Solutions

  1. Ask the bot owner to re-publish (put back on shelf) the market bot
  2. Use a different, on-shelf bot for the chat list
  3. If you believe you are the owner, verify the token resolves to the owner's uid
  4. Update the chat list to reference an accessible bot

Example fix

// before
chatList.botId = offShelfMarketBot.id; // off-shelf, not owner
// after
chatList.botId = publishedBot.id; // ShelfStatus ON_SHELF
Defensive patterns

Strategy: try-catch

Validate before calling

const bot = await getMarketBot(botId); if (bot.botStatus === 'OFF_SHELF' && bot.uid !== currentUid) throw new Error('bot is off-shelf and not owned by you');

Type guard

const canUseMarketBot = (bot, uid) => bot.botStatus !== 'OFF_SHELF' || bot.uid === uid;

Try / catch

try { await useChatList(botId); } catch (e) { if (e.code === 'USER_NO_APPROVEL') { suggestAlternativeOnShelfBot(); } else throw e; }

Prevention

When it happens

Trigger: Fetching or using a chat list that references a market bot whose botStatus is off-shelf while the current authenticated user is not chatBotMarket.uid; accessing a bot right after the owner took it off the marketplace.

Common situations: Bot was unpublished/removed from the market between saving the chat list and using it; sharing a chat link built on an off-shelf bot with a colleague; environment where the bot owner uid differs due to data seeding.

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


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/a4ec22c907925bfd. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/controller/chat/ChatListController.java:166

        if (chatBotMarket != null) {
            validateMarketBotPermissions(chatBotMarket, uid);
        } else {
            validatePrivateBotPermissions(botId, uid);
        }
    }

    /**
     * Validate market bot permissions
     *
     * @param chatBotMarket Chat bot market object
     * @param uid User unique identifier
     * @throws BusinessException Throws business exception if no approved permission
     */
    private void validateMarketBotPermissions(ChatBotMarket chatBotMarket, String uid) {
        if (ShelfStatusEnum.isOffShelf(chatBotMarket.getBotStatus()) &&
                !chatBotMarket.getUid().equals(uid)) {
            throw new BusinessException(ResponseEnum.USER_NO_APPROVEL);
        }
    }

    /**
     * Validate private bot permissions
     *
     * @param botId Bot ID
     * @param uid User ID
     */
    private void validatePrivateBotPermissions(Integer botId, String uid) {
        ChatBotBase chatBotBase = chatBotDataService.findById(botId)
                .orElseThrow(() -> new BusinessException(ResponseEnum.BOT_NOT_EXISTS));

        if (!chatBotBase.getUid().equals(uid)) {
            validateSpacePermissions(chatBotBase);
        }
    }

View on GitHub (pinned to 5e758547a8)