iflytek/astron-agent · error · BusinessException
REPO_FILE_NOT_EXIST
REPO_FILE_NOT_EXIST
Error message
REPO_FILE_NOT_EXIST
What it means
enableFile(id, enabled) toggles a file's enabled state. It throws BusinessException(REPO_FILE_NOT_EXIST) when the FileDirectoryTree row is missing or the node is not a file (isFile != 1). Folders and nonexistent ids cannot be enabled/disabled — only actual file nodes qualify.
Solutions
- Confirm the id refers to an existing tree node with isFile==1 before calling enableFile.
- Filter the id list to file nodes only (exclude nodes with isFile != 1) in bulk operations.
- Refresh the client's file tree so deleted ids are removed from any pending enable/disable queue.
Example fix
// before
for (Long id : selectedIds) {
fileInfoV2Service.enableFile(id, 1); // id may be a folder
}
// after
for (Long id : selectedIds) {
FileDirectoryTree node = fileDirectoryTreeService.getById(id);
if (node != null && node.getIsFile() == 1) {
fileInfoV2Service.enableFile(id, 1);
}
} Defensive patterns
Strategy: validation
Validate before calling
FileDirectoryTree node = fileDirectoryTreeService.getById(id);
if (node == null || node.getIsFile() != 1) {
// skip: not an enableable file node
return;
} Try / catch
try {
fileInfoV2Service.enableFile(id, enabled);
} catch (BusinessException e) {
if ("REPO_FILE_NOT_EXIST".equals(e.getCode())) {
// remove id from selection and notify user
}
} Prevention
- Filter bulk selections to nodes with isFile==1.
- Refresh selection lists after tree changes to drop deleted ids.
- Validate id type/namespace at the call site before toggling.
When it happens
Trigger: Calling enableFile with a tree-node id that doesn't exist, or with the id of a FOLDER node (isFile==0) — e.g. a UI bulk-enable accidentally including folder rows, or a stale id after deletion.
Common situations: Batch scripts iterate tree ids assuming all are files; client keeps a stale selection list after folders/files were deleted or reorganized; wrong id namespace (folder id passed where a file id is required).
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/6bc890a8686d3a5d.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java:2190
}
recursiveFindFatherPath(fileDirectoryTree.getAppId(), fileId, fileDirectoryTreePathList);
Collections.reverse(fileDirectoryTreePathList);
return fileDirectoryTreePathList;
}
/**
* Enable or disable a file in the repository
*
* @param id file directory tree ID
* @param enabled enable status (1=enabled, 0=disabled)
* @throws BusinessException if file does not exist or access is denied
*/
@Transactional
public void enableFile(Long id, Integer enabled) {
FileDirectoryTree fileDirectoryTree = fileDirectoryTreeService.getById(id);
if (fileDirectoryTree == null || fileDirectoryTree.getIsFile() != 1) {
throw new BusinessException(ResponseEnum.REPO_FILE_NOT_EXIST);
}
FileInfoV2 fileInfoV2 = this.getById(fileDirectoryTree.getFileId());
if (fileInfoV2 == null) {
throw new BusinessException(ResponseEnum.REPO_FILE_NOT_EXIST);
}
Repo repo = repoService.getById(fileInfoV2.getRepoId());
if (repo != null) {
try {
dataPermissionCheckTool.checkRepoBelong(repo);
} catch (Exception e) {
log.warn("Unauthorized operation detected, uid={}, fileDirectoryTreeId={}", UserInfoManagerHandler.getUserId(), id);
throw new BusinessException(ResponseEnum.REPO_FILE_NOT_EXIST);
}
}
try {
dataPermissionCheckTool.checkFileBelong(fileInfoV2);View on GitHub (pinned to 5e758547a8)