iflytek/astron-agent · error · BusinessException

LONG_CONTENT_CHAT_ID_ERROR

LONG_CONTENT_CHAT_ID_ERROR

Error message

LONG_CONTENT_CHAT_ID_ERROR

What it means

saveFile resolves the latest child chatId from the chat tree and validates that the resulting chat exists and is enabled for the user; if chatList is missing or enable==0 it throws BusinessException(LONG_CONTENT_CHAT_ID_ERROR). It signals the supplied chat/file context points to a nonexistent or disabled conversation.

Solutions

  1. Refresh the chat list on the client and retry with a valid, enabled chatId
  2. Verify the chat exists and enable==1 for the authenticated uid before uploading
  3. Check logs ('uploaded file with incorrect chatId information') for the uid/vo involved
  4. Handle DATA_NOT_FOUND vs LONG_CONTENT_CHAT_ID_ERROR distinctly in the client to prompt recreation of the conversation

Example fix

// before
await chatApi.saveFile({ chatId: staleChatId, ... });
// after
const chat = await chatApi.getChat(uid, chatId);
if (!chat || chat.enable === 0) { chatId = await createOrPickActiveChat(); }
await chatApi.saveFile({ chatId, ... });
Defensive patterns

Strategy: validation

Validate before calling

const chat = await getChat(uid, chatId); const usable = chat && chat.enable === 1;

Type guard

const isActiveChat = (c: Chat | null | undefined): c is Chat => !!c && c.enable === 1;

Try / catch

try { await chatApi.saveFile(vo); } catch (e) { if (e.code === LONG_CONTENT_CHAT_ID_ERROR) { await refreshChatList(); showToast('Conversation unavailable, please select another'); } }

Prevention

When it happens

Trigger: Uploading a long-content file where vo's chatId resolves through chatTreeIndex to a chatId whose ChatList record is null or has enable==0 for this uid — e.g. chat deleted or disabled after tree lookup.

Common situations: Client caches an old chatId after the conversation was deleted/disabled; two tabs where one deletes the chat; race between chat deletion and file upload; cross-user chatId reuse (uid mismatch).

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

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

     * @return Result of saving the file, including file ID or error information
     */
    @PostMapping(path = "/save-file")
    @Operation(summary = "Save File")
    public ApiResult<String> saveFile(@RequestBody ChatEnhanceSaveFileVo vo) {
        String uid = RequestContextUtil.getUID();
        // Get the latest chat_id
        if (ObjectUtil.isNotEmpty(vo.getChatId()) && vo.getChatId() != 0) {
            Long chatId = vo.getChatId();
            // Get the latest chat_id
            List<ChatTreeIndex> chatTreeIndexList = chatListDataService.findChatTreeIndexByChatIdOrderById(chatId);
            if (chatTreeIndexList.isEmpty()) {
                return ApiResult.error(ResponseEnum.DATA_NOT_FOUND);
            }
            chatId = chatTreeIndexList.getFirst().getChildChatId();
            ChatList chatList = chatListDataService.findByUidAndChatId(uid, chatId);
            if (chatList == null || chatList.getEnable() == 0) {
                log.error("User: {} uploaded file with incorrect chatId information: {}", uid, vo);
                throw new BusinessException(ResponseEnum.LONG_CONTENT_CHAT_ID_ERROR);
            }
            // Set the latest chatId
            vo.setChatId(chatId);
        }
        Map<String, String> saveFileReq = chatEnhanceService.saveFile(uid, vo);
        String fileId = saveFileReq.get("file_id");
        String errorMsg = saveFileReq.get("error_msg");
        if (StringUtils.isNotBlank(fileId)) {
            return ApiResult.success(fileId);
        }
        // If fileId is empty, return error message
        return ApiResult.error(-1, errorMsg);
    }

    /**
     * Unbind file from ChatId
     *
     * @param longFileDto Object containing file ID and optional link ID as well as parameter name

View on GitHub (pinned to 5e758547a8)