{"record":{"id":"03be8f076c06d427","repo":"iflytek/astron-agent","slug":"repo-not-found","errorCode":"REPO_NOT_FOUND","errorMessage":"REPO_NOT_FOUND","messagePattern":"REPO_NOT_FOUND","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java","lineNumber":1840,"sourceCode":"                    fileDirectoryTreeDto.setIsFile(1);\n                    fileDirectoryTreeDto.setAppId(repoId.toString());\n                    fileDirectoryTreeDto.setFileId(relatedDocDto.getId());\n                    fileDirectoryTreeDto.setCreateTime(relatedDocDto.getCreateTime());\n\n                    FileInfoV2 fileInfoV2 = new FileInfoV2();\n                    fileInfoV2.setId(relatedDocDto.getId());\n                    fileInfoV2.setName(relatedDocDto.getName());\n                    fileInfoV2.setCharCount(relatedDocDto.getCharCount().longValue());\n                    fileInfoV2.setStatus(relatedDocDto.getStatus());\n                    fileInfoV2.setEnabled(1);\n                    fileInfoV2.setUuid(relatedDocDto.getDatasetIndex());\n                    fileDirectoryTreeDto.setFileInfoV2(fileInfoV2);\n                }\n            }\n        } else {\n            Repo repo = repoService.getById(repoId);\n            if (repo == null) {\n                throw new BusinessException(ResponseEnum.REPO_NOT_FOUND);\n            }\n            dataPermissionCheckTool.checkRepoBelong(repo);\n            dataPermissionCheckTool.checkRepoVisible(repo);\n            List<FileDirectoryTree> modelListLinkFileInfoV2 = fileDirectoryTreeMapper.getModelListLinkFileInfoV2(MapUtil.builder()\n                    .put(\"appId\", repoId.toString())\n                    .put(\"parentId\", parentId)\n                    .put(\"isRepoPage\", isRepoPage)\n                    .put(\"start\", (pageNo - 1) * 10)\n                    .put(\"limit\", pageSize)\n                    .put(\"safeOrderBy\", \"create_time desc\")\n                    .build());\n            if (!CollectionUtils.isEmpty(modelListLinkFileInfoV2)) {\n                for (FileDirectoryTree fileDirectoryTree : modelListLinkFileInfoV2) {\n                    FileDirectoryTreeDto fileDirectoryTreeDto = new FileDirectoryTreeDto();\n                    fileDirectoryTreeDtoList.add(fileDirectoryTreeDto);\n                    BeanUtils.copyProperties(fileDirectoryTree, fileDirectoryTreeDto);\n                    // if (fileDirectoryTree.getIsFile()==1) {\n                    // FileInfoV2 fileInfoV2 = this.getById(fileDirectoryTree.getFileId());","sourceCodeStart":1822,"sourceCodeEnd":1858,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java#L1822-L1858","documentation":"In the tag==null/empty branch of queryFileList, the service loads the Repo by id; if repoService.getById(repoId) returns null it throws BusinessException(REPO_NOT_FOUND). The repo referenced by repoId does not exist in the database (or is soft-deleted), so no listing can be produced and permission checks (checkRepoBelong/checkRepoVisible) never run.","triggerScenarios":"Calling queryFileList with a tagless request whose repoId has no matching row in the repo table: deleted repo, wrong repoId typed/hardcoded, repo from another environment/db, or an id from a stale client cache.","commonSituations":"User opens a bookmarked link to a repo deleted meanwhile; test/staging repoId used against production DB; data cleanup jobs removed the repo but UI shortcuts remain; cross-space id confusion.","solutions":["Verify the repoId exists (SELECT from repo table / list repos via API) and use a valid id.","Refresh or clear stale client state/bookmarks pointing at the deleted repo.","Confirm you are hitting the correct environment's database; align client config with the target environment."],"exampleFix":"// before\nlong repoId = 123L; // hardcoded, no longer exists\nfileService.queryFileList(repoId, 0L, 1, 20, \"\", request, 1);\n// after\nLong repoId = fetchValidRepoIdFromApi();\nif (repoId != null) {\n    fileService.queryFileList(repoId, 0L, 1, 20, \"\", request, 1);\n}","handlingStrategy":"try-catch","validationCode":"Repo repo = repoService.getById(repoId);\nif (repo == null) {\n    // fail fast client-side: redirect to repo selection UI\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    Object page = fileInfoV2Service.queryFileList(repoId, parentId, pageNo, pageSize, \"\", request, 1);\n} catch (BusinessException e) {\n    if (\"REPO_NOT_FOUND\".equals(e.getCode())) {\n        // clear stale repo id, notify user, offer repo picker\n    }\n}","preventionTips":["Check repo existence when hydrating bookmarks/deep links.","Keep client repo caches invalidated on delete events.","Confirm environment (dev/staging/prod) before reusing hardcoded repo ids."],"tags":["resource-not-found","entity","http-api"],"backgroundTag":"resource-not-found","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}