iflytek/astron-agent · error · RuntimeException
File not found
Error message
File not found
What it means
updateFile loads the FileDirectoryTree node by folderVO.id; when fileDirectoryTreeService.getById returns null it throws a plain RuntimeException("File not found") (not a BusinessException). The tree node targeted for rename/update does not exist, so the update cannot proceed.
Solutions
- Verify the FileDirectoryTree id exists (via file-list API) before calling updateFile.
- Refresh the file tree in the client so stale ids are replaced with current ones.
- Ensure the id passed is the tree-node id (fileDirectoryTree.id), not the FileInfoV2 file id.
Example fix
// before CreateFolderVO vo = new CreateFolderVO(); vo.setId(deletedNodeId); fileInfoV2Service.updateFile(vo); // after Long nodeId = fetchCurrentTreeNodeId(fileName); CreateFolderVO vo = new CreateFolderVO(); vo.setId(nodeId); fileInfoV2Service.updateFile(vo);
Defensive patterns
Strategy: try-catch
Validate before calling
FileDirectoryTree node = fileDirectoryTreeService.getById(vo.getId());
if (node == null) {
// refresh tree, abort update
return;
} Try / catch
try {
fileInfoV2Service.updateFile(vo);
} catch (RuntimeException e) {
if ("File not found".equals(e.getMessage())) {
// refresh file tree and inform user the file no longer exists
}
} Prevention
- Pass the tree-node id (not the FileInfoV2 id) to updateFile.
- Refresh the tree after any concurrent edit/delete to avoid stale ids.
- Handle concurrent-delete conflicts: on save failure, reload before retrying.
When it happens
Trigger: Calling updateFile with an id that has no row in the file-directory-tree table: deleted node, stale id in the client, wrong id field passed (e.g. fileInfoV2 id instead of tree-node id), or id from another environment.
Common situations: Two users edit concurrently and one deletes the file while the other saves a rename; frontend cache holds ids from a previous session; scripts hardcode ids after a data migration.
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/fe905debe4928ded.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java:1960
FileDirectoryTree fileDirectoryTree = fileDirectoryTreeService.getById(folderVO.getId());
fileDirectoryTree.setName(folderVO.getName());
fileDirectoryTree.setUpdateTime(LocalDateTime.now());
fileDirectoryTreeService.updateById(fileDirectoryTree);
}
/**
* Update file name in directory tree and file info table
*
* @param folderVO file update parameters containing ID and new name
* @throws RuntimeException if file is not found
* @throws BusinessException if file access is denied
*/
public void updateFile(CreateFolderVO folderVO) {
FileDirectoryTree fileDirectoryTree = fileDirectoryTreeService.getById(folderVO.getId());
Long spaceId = SpaceInfoUtil.getSpaceId();
if (fileDirectoryTree == null) {
throw new RuntimeException("File not found");
}
FileInfoV2 fileInfoV2 = this.getById(fileDirectoryTree.getFileId());
if (fileInfoV2 == null) {
throw new RuntimeException("File not found");
}
if (null == spaceId) {
dataPermissionCheckTool.checkFileBelong(fileInfoV2);
}
fileDirectoryTree.setName(folderVO.getName());
fileDirectoryTree.setUpdateTime(LocalDateTime.now());
fileDirectoryTreeService.updateById(fileDirectoryTree);
fileInfoV2.setName(folderVO.getName());
fileInfoV2.setUpdateTime(new Timestamp(System.currentTimeMillis()));
this.updateById(fileInfoV2);
}
View on GitHub (pinned to 5e758547a8)