iflytek/astron-agent · error · BusinessException

REPO_NOT_EXIST

REPO_NOT_EXIST

Error message

ResponseEnum.REPO_NOT_EXIST

What it means

updateRepo loads the Repo by repoVO.getId() with this.getById(); if no row exists it throws REPO_NOT_EXIST. This means the update targeted a knowledge-base id that is not present in the repo table. Soft-deleted rows (deleted=1) are filtered by the ORM base layer, so deleting a repo then updating it also yields this error.

Solutions

  1. Fetch the current repo id (GET repo detail) before updating and retry with the fresh id
  2. Check the repo was not deleted (deleted=0) — if deleted, recreate or restore instead of updating
  3. Verify the environment/datasource: an id from one deployment does not exist in another database
  4. Guard the client: treat 404-style REPO_NOT_EXIST as 'resource gone' and refresh the local list

Example fix

// before
repoService.updateRepo(staleVo);
// after
if (repoService.getById(staleVo.getId()) == null) {
    throw new BusinessException(ResponseEnum.REPO_NOT_EXIST); // surfaced early
}
repoService.updateRepo(staleVo);
Defensive patterns

Strategy: try-catch

Validate before calling

if (repoService.getById(repoVO.getId()) == null) {
    throw new BusinessException(ResponseEnum.REPO_NOT_EXIST);
}

Try / catch

try {
    repoService.updateRepo(vo);
} catch (BusinessException e) {
    if ("REPO_NOT_EXIST".equals(e.getCode())) {
        refreshRepoList(); // stale id — reload
    }
}

Prevention

When it happens

Trigger: PUT/update calls with a stale or fabricated repo id; updating a repo that was already (soft-)deleted; a wrong id type/casting so getById finds nothing; cross-space access where the row exists but MyBatis-Plus logical-delete filtering hides it.

Common situations: Frontend cached a repo list, user deleted the repo in another tab, then saved edits; automated scripts replaying updates against ids from an older environment; integration tests using seeded ids that were rolled back.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/RepoService.java:249

        groupVisibilityService.setRepoVisibility(repo.getId(), 1, visibility, repoVO.getUids());
        return repo;
    }


    /**
     * Update an existing repository with new information. Validates repository existence, ownership,
     * and name uniqueness before updating.
     *
     * @param repoVO repository value object containing update information
     * @return updated Repo object
     * @throws BusinessException if repository does not exist, user has no permission, or name is
     *         duplicate
     */
    @Transactional
    public Repo updateRepo(RepoVO repoVO) {
        Repo model = this.getById(repoVO.getId());
        if (model == null) {
            throw new BusinessException(ResponseEnum.REPO_NOT_EXIST);
        }
        dataPermissionCheckTool.checkRepoBelong(model);
        Long spaceId = SpaceInfoUtil.getSpaceId();
        Repo existRepo;
        if (spaceId == null) {
            existRepo = this.getOnly(Wrappers.lambdaQuery(Repo.class).eq(Repo::getUserId, UserInfoManagerHandler.getUserId()).eq(Repo::getName, repoVO.getName()).eq(Repo::getDeleted, 0));
        } else {
            existRepo = this.getOnly(Wrappers.lambdaQuery(Repo.class).eq(Repo::getSpaceId, spaceId).eq(Repo::getName, repoVO.getName()).eq(Repo::getDeleted, 0));
        }
        if (existRepo != null) {
            if (!Objects.equals(existRepo.getId(), repoVO.getId())) {
                throw new BusinessException(ResponseEnum.REPO_NAME_DUPLICATE);
            }

        }
        Integer visibility = repoVO.getVisibility() == null ? 0 : repoVO.getVisibility();
        model.setVisibility(visibility);
        model.setName(repoVO.getName());

View on GitHub (pinned to 5e758547a8)