iflytek/astron-agent · warning

WeChat official account record not found for unbinding…

Error message

WeChat official account record not found for unbinding: appid={}

What it means

WARN log from the WeChat official-account unbind flow: no BotOffiaccount record matched the given appid, so unbinding (including the PublishChannelUpdateEvent) is silently skipped. Callers get no error — the operation is a no-op.

Solutions

  1. Verify the appid exists in bot_offiaccount before calling unbind (query via getAccountList or mapper).
  2. Make unbind return a boolean/result so callers can detect the not-found case instead of silently succeeding.
  3. If idempotent unbind is desired, keep the log as info-level and document the no-op behavior.

Example fix

// before
log.warn("WeChat official account record not found for unbinding: appid={}", appid);
// after
log.warn("WeChat official account record not found for unbinding: appid={}", appid);
throw new BusinessException(ResponseEnum.OFFIACCOUNT_NOT_BOUND); // or return false
Defensive patterns

Strategy: validation

Validate before calling

BotOffiaccount existing = botOffiaccountMapper.selectOne(new LambdaQueryWrapper<BotOffiaccount>().eq(BotOffiaccount::getAppid, appid));
if (existing == null) { /* skip or error before calling unbind */ }

Prevention

When it happens

Trigger: Calling unbind(appid) for an appid that was never bound, was already unbound, or whose rows are filtered (uid/tenant mismatch).

Common situations: Duplicate unbind callbacks from WeChat; appid typos; records deleted manually or by a concurrent process before unbind runs.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/wechat/impl/BotOffiaccountServiceImpl.java:125

        BotOffiaccount botOffiaccount = botOffiaccountMapper.selectOne(
                new LambdaQueryWrapper<BotOffiaccount>()
                        .eq(BotOffiaccount::getAppid, appid)
                        .eq(BotOffiaccount::getStatus, BotOffiaccountStatusEnum.BOUND.getStatus()));
        if (botOffiaccount != null) {
            ChatBotBase botBase = chatBotBaseMapper.selectById(botOffiaccount.getBotId());

            botOffiaccount.setStatus(BotOffiaccountStatusEnum.UNBOUND.getStatus());
            botOffiaccount.setUpdateTime(LocalDateTime.now());
            botOffiaccountMapper.updateById(botOffiaccount);

            eventPublisher.publishEvent(new PublishChannelUpdateEvent(
                    this, botOffiaccount.getBotId(), botOffiaccount.getUid(),
                    botBase != null ? botBase.getSpaceId() : null, PublishChannelEnum.WECHAT, false));

            log.info("WeChat official account unbinding successful: botId={}, appid={}", botOffiaccount.getBotId(), appid);
        } else {
            log.warn("WeChat official account record not found for unbinding: appid={}", appid);
        }
    }

    @Override
    public List<BotOffiaccount> getAccountList(String uid) {
        return botOffiaccountMapper.selectList(
                new LambdaQueryWrapper<BotOffiaccount>()
                        .eq(BotOffiaccount::getUid, uid)
                        .eq(BotOffiaccount::getStatus, BotOffiaccountStatusEnum.BOUND.getStatus())
                        .orderByDesc(BotOffiaccount::getUpdateTime));
    }

    @Override
    public BotOffiaccount getByAppid(String appid) {
        return botOffiaccountMapper.selectOne(
                new LambdaQueryWrapper<BotOffiaccount>()
                        .eq(BotOffiaccount::getAppid, appid)
                        .eq(BotOffiaccount::getStatus, BotOffiaccountStatusEnum.BOUND.getStatus()));

View on GitHub (pinned to 5e758547a8)