{"record":{"id":"b9c7317e4838e20b","repo":"iflytek/astron-agent","slug":"bot-not-exists-b9c731","errorCode":"BOT_NOT_EXISTS","errorMessage":"BOT_NOT_EXISTS","messagePattern":"BOT_NOT_EXISTS","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/PublishApprovalServiceImpl.java","lineNumber":279,"sourceCode":"    }\n\n    private boolean isOwnerOrAdmin(SpaceRoleEnum role) {\n        return SpaceRoleEnum.OWNER == role || SpaceRoleEnum.ADMIN == role;\n    }\n\n    private boolean isApprovalEnabledPublishType(PublishApprovalTypeEnum publishType) {\n        return PublishApprovalTypeEnum.MARKET == publishType || PublishApprovalTypeEnum.API == publishType;\n    }\n\n    private void validateApprovalTarget(PublishApprovalSubmitDto submitDto) {\n        if (PublishApprovalResourceTypeEnum.BOT == submitDto.getResourceType()) {\n            Integer botId = parseBotId(submitDto.getResourceId());\n            int hasPermission = chatBotBaseMapper.checkBotPermission(\n                    botId,\n                    submitDto.getRequesterUid(),\n                    submitDto.getSpaceId());\n            if (hasPermission <= 0) {\n                throw new BusinessException(ResponseEnum.BOT_NOT_EXISTS);\n            }\n        }\n\n        if (PublishApprovalTypeEnum.API == submitDto.getPublishType()\n                && (StringUtils.isBlank(submitDto.getTargetId())\n                        || appMstService.getByAppId(submitDto.getRequesterUid(), submitDto.getTargetId()) == null)) {\n            throw new BusinessException(ResponseEnum.USER_APP_ID_NOT_EXISTE);\n        }\n    }\n\n    private Integer parseBotId(String resourceId) {\n        if (StringUtils.isBlank(resourceId)) {\n            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);\n        }\n        try {\n            return Integer.valueOf(resourceId);\n        } catch (NumberFormatException e) {\n            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/PublishApprovalServiceImpl.java#L261-L297","documentation":"BOT_NOT_EXISTS in validateApprovalTarget (called by submitIfRequired) is thrown when chatBotBaseMapper.checkBotPermission returns 0, meaning the requester has no access to (or the space has no) the bot identified by resourceId. The approval target bot is missing or inaccessible in the submitted space.","triggerScenarios":"BOT-type publish approval where parseBotId(resourceId) yields a botId for which checkBotPermission(botId, requesterUid, spaceId) <= 0.","commonSituations":"Bot belongs to a different space than the one submitted; bot deleted; wrong resourceId string from the client; uid/space mismatch in auth context.","solutions":["Verify the bot exists in the submitted space and the requester has permission.","Correct the resourceId/botId in the submit DTO.","Ensure submitDto.spaceId matches the bot's actual space.","Fix bot ownership or space membership, then re-submit."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"int hasPermission = chatBotBaseMapper.checkBotPermission(botId, requesterUid, spaceId);\nif (hasPermission <= 0) {\n    // bot missing or inaccessible in this space; fix before submitting approval\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    publishApprovalService.submitIfRequired(submitDto);\n} catch (BusinessException e) {\n    if (\"BOT_NOT_EXISTS\".equals(String.valueOf(e.getCode()))) {\n        // fix resourceId/spaceId or request access, then resubmit\n    }\n}","preventionTips":["Send the spaceId the bot actually belongs to.","Validate resourceId parses to an accessible bot before submit.","Refresh bot references after deletions."],"tags":["bot","not-found","permissions","publish-approval"],"backgroundTag":"resource-not-found","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}