iflytek/astron-agent · error · BusinessException
REPO_NOT_EXIST
REPO_NOT_EXIST
Error message
ResponseEnum.REPO_NOT_EXIST
What it means
In KnowledgeService.getRepoContext(), after the file record is found, the parent repo is loaded with repoService.getById(fileInfoV2.getRepoId()). If the Repo row referenced by the file's repoId is missing, BusinessException(REPO_NOT_EXIST) is thrown. This indicates orphaned metadata: the file exists but its owning knowledge-base repo does not.
Solutions
- Check the repo exists: SELECT * FROM repo WHERE id = <fileInfoV2.repoId> AND deleted = 0.
- If the repo was intentionally deleted, clean up or ignore the orphaned file records instead of operating on them.
- Restore the missing repo row from backup/migration if the file must remain usable.
- Add a cascade/cleanup step to repo deletion so file_info_v2 rows are removed or marked, preventing orphaned references.
Example fix
// before
Repo repo = repoService.getById(file.getRepoId()); // may be null -> REPO_NOT_EXIST
// after
Repo repo = repoService.getOnly(Wrappers.lambdaQuery(Repo.class)
.eq(Repo::getId, file.getRepoId()).eq(Repo::getDeleted, 0));
if (repo == null) {
// treat file as orphaned: skip it or surface 'parent knowledge base was deleted'
} Defensive patterns
Strategy: validation
Validate before calling
Repo repo = repoService.getOnly(Wrappers.lambdaQuery(Repo.class)
.eq(Repo::getId, repoId).eq(Repo::getDeleted, 0));
if (repo == null) { /* parent repo gone; do not operate on the file */ } Type guard
boolean repoExists(Long repoId) { return repoId != null && repoService.getById(repoId) != null; } Try / catch
try {
knowledgeService.getRepoContext(fileId);
} catch (BusinessException e) {
if (ResponseEnum.REPO_NOT_EXIST.getCode().equals(e.getCode())) {
// treat file as orphaned; surface 'knowledge base was deleted'
} else { throw e; }
} Prevention
- Cascade file cleanup when deleting a repo to avoid orphaned file records.
- Filter on deleted=0 consistently when checking repo existence.
- Watch for partially restored/migrated databases and reconcile repo/file tables.
- Alert on files whose repoId has no matching repo row.
When it happens
Trigger: getRepoContext(fileId) is invoked and the repo backing fileInfoV2.getRepoId() was deleted (repo deletion that did not cascade to file records), the repoId points to another tenant's repo, or the database was partially restored/migrated so the repo row is absent.
Common situations: Repo deleted while files remained referenced (soft-delete inconsistency); environment sync where file table was copied but repo table was not; manual DB edits; concurrent repo deletion between file lookup and repo lookup.
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
- BOT_CHAIN_SUBMIT_ERROR
- 8113
- REPO_CREATE_RAGFLOW_FAILED
- REPO_KNOWLEDGE_ADD_FAILED
- TOOLBOX_NOT_EXIST_MODIFY
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/780679585f280806.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/KnowledgeService.java:1439
private final String ragflowDatasetId;
private RepoContext(String fileUuid, String coreRepoId, String lastUuid,
String ragflowDatasetId) {
this.fileUuid = fileUuid;
this.coreRepoId = coreRepoId;
this.lastUuid = lastUuid;
this.ragflowDatasetId = ragflowDatasetId;
}
}
private RepoContext getRepoContext(Long fileId) {
FileInfoV2 fileInfoV2 = fileInfoV2Service.getById(fileId);
if (fileInfoV2 == null) {
throw new BusinessException(ResponseEnum.REPO_FILE_NOT_EXIST);
}
Repo repo = repoService.getById(fileInfoV2.getRepoId());
if (repo == null) {
throw new BusinessException(ResponseEnum.REPO_NOT_EXIST);
}
String datasetId = ProjectContent.FILE_SOURCE_RAG_FLOW_RAG_STR.equals(fileInfoV2.getSource())
? repo.getRagflowDatasetId()
: null;
return new RepoContext(fileInfoV2.getUuid(), repo.getCoreRepoId(),
fileInfoV2.getLastUuid(), datasetId);
}
private List<String> preCheck(Long fileId) {
RepoContext context = getRepoContext(fileId);
List<String> uuids = new ArrayList<>();
uuids.add(context.fileUuid);
uuids.add(context.coreRepoId);
uuids.add(context.lastUuid);
return uuids;
}
private void applyRagflowDatasetId(KnowledgeRequest request, String source, String datasetId) {View on GitHub (pinned to 5e758547a8)