iflytek/astron-agent · warning · BusinessException
REPO_FILE_DISABLED
REPO_FILE_DISABLED
Error message
ResponseEnum.REPO_FILE_DISABLED
What it means
During hitTest, RepoService scans the repo's files (fileInfoV2 records) and throws REPO_FILE_DISABLED when none of them has enabled == 1. A repo with zero enabled documents cannot answer queries, so retrieval is refused before calling the knowledge service.
Solutions
- Enable at least one file in the repo (set enabled=1 via the file management API) and re-run the hit test
- Re-publish/re-enable the repo if it was unpublished (see enableRepo with enabled=1)
- Check document processing status — re-upload or re-index files stuck in disabled state
- Catch REPO_FILE_DISABLED client-side and show 'enable documents before testing retrieval'
Example fix
// before hitTest(repoId, ...); // all files disabled // after fileService.enableFile(fileId, 1); // enable a document first hitTest(repoId, ...);
Defensive patterns
Strategy: validation
Validate before calling
List<FileInfoV2> files = fileInfoService.listByRepoId(repoId);
boolean anyEnabled = files.stream().anyMatch(f -> f.getEnabled() == 1);
if (!anyEnabled) {
throw new IllegalStateException("Enable at least one document before hit test");
} Try / catch
try {
repoService.hitTest(repoId, query, topN, true);
} catch (BusinessException e) {
if ("REPO_FILE_DISABLED".equals(e.getCode())) {
// guide user to enable documents
}
} Prevention
- Enable at least one file before testing retrieval
- Re-publish repos after unpublishing to re-enable files
- Monitor indexing pipeline so files do not remain stuck disabled
- Surface enabled-file count in the UI before hit test
When it happens
Trigger: Running hitTest on a repo whose documents were all disabled (enabled=0), or a repo created but with no enabled files indexed yet; files disabled after a failed indexing/publish cycle.
Common situations: User unpublished a knowledge base (disabling its files) and later runs a hit test; batch import left files pending/disabled; admin toggled files off while debugging and forgot to re-enable.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/aa4f610fa8dd11c3.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/RepoService.java:779
}
if (isBelongLoginUser) {
dataPermissionCheckTool.checkRepoBelong(repo);
}
List<FileDirectoryTree> fileDirectoryTrees = directoryTreeService.list(Wrappers.lambdaQuery(FileDirectoryTree.class).eq(FileDirectoryTree::getAppId, repo.getId()).eq(FileDirectoryTree::getIsFile, 1));
if (CollectionUtils.isEmpty(fileDirectoryTrees)) {
return new JSONArray();
}
boolean hasEnabledFile = false;
for (FileDirectoryTree fileDirectoryTree : fileDirectoryTrees) {
FileInfoV2 fileInfoV2 = fileInfoV2Service.getById(fileDirectoryTree.getFileId());
if (fileInfoV2 != null && fileInfoV2.getEnabled() == 1) {
hasEnabledFile = true;
break;
}
}
if (!hasEnabledFile) {
throw new BusinessException(ResponseEnum.REPO_FILE_DISABLED);
}
QueryRequest request = this.getKnowledgeQueryObject(repo, topN, query);
KnowledgeResponse resp = knowledgeV2ServiceCallHandler.knowledgeQuery(request);
if (resp.getCode() != 0) {
log.error("Knowledge retrieval failed, message:{}", resp.getMessage());
throw new BusinessException(ResponseEnum.REPO_KNOWLEDGE_QUERY_FAILED);
}
HitTestHistory hitTestHistory = new HitTestHistory();
hitTestHistory.setRepoId(id);
hitTestHistory.setUserId(UserInfoManagerHandler.getUserId());
hitTestHistory.setQuery(query);
hitTestHistory.setCreateTime(new Timestamp(System.currentTimeMillis()));
historyService.save(hitTestHistory);
QueryRespData data = JSON.parseObject(resp.getData().toString(), QueryRespData.class);View on GitHub (pinned to 5e758547a8)