{"record":{"id":"ad36f38e60d78ed7","repo":"iflytek/astron-agent","slug":"file-not-process","errorCode":"FILE_NOT_PROCESS","errorMessage":"FILE_NOT_PROCESS","messagePattern":"FILE_NOT_PROCESS","errorType":"exception","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/controller/chat/ChatEnhanceController.java","lineNumber":122,"sourceCode":"        if (StringUtils.isBlank(fileId) && StringUtils.isBlank(linkIdString)) {\n            throw new BusinessException(ResponseEnum.LONG_CONTENT_MISS_FILE_INFO);\n        }\n        String uid = RequestContextUtil.getUID();\n        // Get the latest chat_id\n        List<ChatTreeIndex> chatTreeIndexList = chatListDataService.findChatTreeIndexByChatIdOrderById(chatId);\n        if (chatTreeIndexList.isEmpty()) {\n            throw new BusinessException(ResponseEnum.DATA_NOT_FOUND);\n        }\n        chatId = chatTreeIndexList.getFirst().getChildChatId();\n        ChatList chatList = chatListDataService.findByUidAndChatId(uid, chatId);\n        if (chatList == null || chatList.getEnable() == 0) {\n            throw new BusinessException(ResponseEnum.LONG_CONTENT_CHAT_ID_ERROR);\n        }\n        // Logical deletion of chatFileReq (unbind file from chatID)\n        if (StringUtils.isNotBlank(linkIdString)) {\n            ChatFileUser chatFileUser = chatEnhanceService.findById(Long.valueOf(linkIdString), uid);\n            if (chatFileUser == null || chatFileUser.getFileId() == null) {\n                throw new BusinessException(ResponseEnum.FILE_NOT_PROCESS);\n            }\n            fileId = chatFileUser.getFileId();\n        }\n        chatEnhanceService.delete(fileId, chatId, uid);\n\n        if (StrUtil.isNotEmpty(longFileDto.getParamName())) {\n            List<BotChatFileParam> oneByChatIdAndNameList = chatDataService.findAllBotChatFileParamByChatIdAndNameAndIsDelete(chatId, longFileDto.getParamName(), 0);\n            for (BotChatFileParam oneByChatIdAndNameAndIsDelete : oneByChatIdAndNameList) {\n                int i = oneByChatIdAndNameAndIsDelete.getFileIds().indexOf(fileId);\n                if (i >= 0) {\n                    oneByChatIdAndNameAndIsDelete.getFileIds().remove(i);\n                    oneByChatIdAndNameAndIsDelete.getFileUrls().remove(i);\n                    oneByChatIdAndNameAndIsDelete.setUpdateTime(LocalDateTime.now());\n                    chatDataService.updateBotChatFileParam(oneByChatIdAndNameAndIsDelete);\n                }\n            }\n        }\n        return ApiResult.success();","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/controller/chat/ChatEnhanceController.java#L104-L140","documentation":"FILE_NOT_PROCESS is thrown in unbindFile when the request carries a linkId but chatEnhanceService.findById(linkId, uid) returns null or a ChatFileUser whose fileId is null. The link record identifying the file-chat binding cannot be found for this user, so the unbind cannot identify which file to delete.","triggerScenarios":"unbind-file with a linkId that does not exist, belongs to another user (uid mismatch), references a row whose fileId column is null, or where linkIdString is not a parseable number (NumberFormatException on Long.valueOf also surfaces here).","commonSituations":"Client passing a fabricated/stale linkId; mixing linkIds across user accounts; passing a non-numeric string in linkId causing a parse failure before the lookup.","solutions":["Pass the linkId exactly as returned by the bind/upload response for the same user","Verify the linkId is numeric and valid before sending","If only the fileId is known, send fileId instead of linkId","Confirm you are authenticated as the user that created the link"],"exampleFix":"// before\n{ \"chatId\": 1, \"linkId\": \"not-a-number\" }\n// after\n{ \"chatId\": 1, \"linkId\": \"42\" }","handlingStrategy":"validation","validationCode":"if (dto.linkId != null && !/^\\d+$/.test(String(dto.linkId))) throw new Error('linkId must be numeric');","typeGuard":"const hasValidLinkId = (d) => d.linkId != null && /^\\d+$/.test(String(d.linkId));","tryCatchPattern":"try { await unbindFile(dto); } catch (e) { if (e.code === 'FILE_NOT_PROCESS') { fallbackToUnbindByFileId(dto); } else throw e; }","preventionTips":["Store the linkId returned at bind time and reuse it verbatim","Never fabricate or transform linkIds across users/environments","Prefer fileId when the binding id is unknown","Sanitize linkId to a numeric string before sending"],"tags":["not-found","file","binding"],"backgroundTag":"record-not-found","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}