iflytek/astron-agent · error · BusinessException

FILE_NOT_PROCESS

FILE_NOT_PROCESS

Error message

FILE_NOT_PROCESS

What it means

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.

Solutions

  1. Pass the linkId exactly as returned by the bind/upload response for the same user
  2. Verify the linkId is numeric and valid before sending
  3. If only the fileId is known, send fileId instead of linkId
  4. Confirm you are authenticated as the user that created the link

Example fix

// before
{ "chatId": 1, "linkId": "not-a-number" }
// after
{ "chatId": 1, "linkId": "42" }
Defensive patterns

Strategy: validation

Validate before calling

if (dto.linkId != null && !/^\d+$/.test(String(dto.linkId))) throw new Error('linkId must be numeric');

Type guard

const hasValidLinkId = (d) => d.linkId != null && /^\d+$/.test(String(d.linkId));

Try / catch

try { await unbindFile(dto); } catch (e) { if (e.code === 'FILE_NOT_PROCESS') { fallbackToUnbindByFileId(dto); } else throw e; }

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/ad36f38e60d78ed7. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/controller/chat/ChatEnhanceController.java:122

        if (StringUtils.isBlank(fileId) && StringUtils.isBlank(linkIdString)) {
            throw new BusinessException(ResponseEnum.LONG_CONTENT_MISS_FILE_INFO);
        }
        String uid = RequestContextUtil.getUID();
        // Get the latest chat_id
        List<ChatTreeIndex> chatTreeIndexList = chatListDataService.findChatTreeIndexByChatIdOrderById(chatId);
        if (chatTreeIndexList.isEmpty()) {
            throw new BusinessException(ResponseEnum.DATA_NOT_FOUND);
        }
        chatId = chatTreeIndexList.getFirst().getChildChatId();
        ChatList chatList = chatListDataService.findByUidAndChatId(uid, chatId);
        if (chatList == null || chatList.getEnable() == 0) {
            throw new BusinessException(ResponseEnum.LONG_CONTENT_CHAT_ID_ERROR);
        }
        // Logical deletion of chatFileReq (unbind file from chatID)
        if (StringUtils.isNotBlank(linkIdString)) {
            ChatFileUser chatFileUser = chatEnhanceService.findById(Long.valueOf(linkIdString), uid);
            if (chatFileUser == null || chatFileUser.getFileId() == null) {
                throw new BusinessException(ResponseEnum.FILE_NOT_PROCESS);
            }
            fileId = chatFileUser.getFileId();
        }
        chatEnhanceService.delete(fileId, chatId, uid);

        if (StrUtil.isNotEmpty(longFileDto.getParamName())) {
            List<BotChatFileParam> oneByChatIdAndNameList = chatDataService.findAllBotChatFileParamByChatIdAndNameAndIsDelete(chatId, longFileDto.getParamName(), 0);
            for (BotChatFileParam oneByChatIdAndNameAndIsDelete : oneByChatIdAndNameList) {
                int i = oneByChatIdAndNameAndIsDelete.getFileIds().indexOf(fileId);
                if (i >= 0) {
                    oneByChatIdAndNameAndIsDelete.getFileIds().remove(i);
                    oneByChatIdAndNameAndIsDelete.getFileUrls().remove(i);
                    oneByChatIdAndNameAndIsDelete.setUpdateTime(LocalDateTime.now());
                    chatDataService.updateBotChatFileParam(oneByChatIdAndNameAndIsDelete);
                }
            }
        }
        return ApiResult.success();

View on GitHub (pinned to 5e758547a8)