iflytek/astron-agent · error · BusinessException

USER_APP_ID_NOT_EXISTE

USER_APP_ID_NOT_EXISTE

Error message

USER_APP_ID_NOT_EXISTE

What it means

USER_APP_ID_NOT_EXISTE in validateApprovalTarget is thrown when an API-type publish approval has a blank targetId or the targetId does not resolve to an app_mst record for the requester. The API publish target must reference an existing application owned by the user.

Solutions

  1. Provide a valid non-blank targetId (existing appId owned by the requester).
  2. Create the app first and use its appId as the target.
  3. Verify app_mst has a row for (requesterUid, targetId).
  4. Confirm the publish type is correct if a BOT approval was intended.
Defensive patterns

Strategy: validation

Validate before calling

if (submitType == PublishApprovalTypeEnum.API
        && (targetId == null || targetId.isBlank()
            || appMstService.getByAppId(requesterUid, targetId) == null)) {
    // invalid/missing appId target; abort before submitting
    return;
}

Try / catch

try {
    publishApprovalService.submitIfRequired(submitDto);
} catch (BusinessException e) {
    if ("USER_APP_ID_NOT_EXISTE".equals(String.valueOf(e.getCode()))) {
        // prompt user to select a valid app as target
    }
}

Prevention

When it happens

Trigger: PublishApprovalTypeEnum.API submission with targetId null/blank, or appMstService.getByAppId(requesterUid, targetId) returning null.

Common situations: Client omits targetId for API publishes; appId of a deleted app; appId created under another account; publish type set to API without a target.

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/ec796395d383bd18. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/PublishApprovalServiceImpl.java:286

        return PublishApprovalTypeEnum.MARKET == publishType || PublishApprovalTypeEnum.API == publishType;
    }

    private void validateApprovalTarget(PublishApprovalSubmitDto submitDto) {
        if (PublishApprovalResourceTypeEnum.BOT == submitDto.getResourceType()) {
            Integer botId = parseBotId(submitDto.getResourceId());
            int hasPermission = chatBotBaseMapper.checkBotPermission(
                    botId,
                    submitDto.getRequesterUid(),
                    submitDto.getSpaceId());
            if (hasPermission <= 0) {
                throw new BusinessException(ResponseEnum.BOT_NOT_EXISTS);
            }
        }

        if (PublishApprovalTypeEnum.API == submitDto.getPublishType()
                && (StringUtils.isBlank(submitDto.getTargetId())
                        || appMstService.getByAppId(submitDto.getRequesterUid(), submitDto.getTargetId()) == null)) {
            throw new BusinessException(ResponseEnum.USER_APP_ID_NOT_EXISTE);
        }
    }

    private Integer parseBotId(String resourceId) {
        if (StringUtils.isBlank(resourceId)) {
            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);
        }
        try {
            return Integer.valueOf(resourceId);
        } catch (NumberFormatException e) {
            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);
        }
    }

    private Workflow resolveWorkflow(String resourceId) {
        if (StringUtils.isBlank(resourceId)) {
            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);
        }

View on GitHub (pinned to 5e758547a8)