iflytek/astron-agent · warning · BusinessException
LONG_CONTENT_MISS_FILE_INFO
LONG_CONTENT_MISS_FILE_INFO
Error message
LONG_CONTENT_MISS_FILE_INFO
What it means
unbindFile validates the unbind request and throws BusinessException(LONG_CONTENT_MISS_FILE_INFO) when chatId is blank (and, per the following check, when both fileId and linkId are blank). The request lacks the minimum identifying information needed to unbind a file from a conversation.
Solutions
- Ensure chatId is always set in the request body before calling unbind-file
- Provide either fileId or linkId along with chatId (the endpoint requires at least one)
- Validate the DTO client-side and show a form error instead of hitting the API
- Catch BusinessException and map LONG_CONTENT_MISS_FILE_INFO to a 'missing file information' user message
Example fix
// before
await chatApi.unbindFile({ chatId });
// after
if (!chatId || (!fileId && !linkId)) { showError('chatId and (fileId or linkId) are required'); return; }
await chatApi.unbindFile({ chatId, fileId, linkId }); Defensive patterns
Strategy: validation
Validate before calling
const canUnbind = Boolean(chatId && chatId.trim()) && (Boolean(fileId) || Boolean(linkId));
Type guard
const hasFileRef = (d: LongFileDto): boolean => !!(d.chatId?.trim() && (d.fileId || d.linkId));
Try / catch
try { await chatApi.unbindFile(dto); } catch (e) { if (e.code === LONG_CONTENT_MISS_FILE_INFO) showToast('chatId and fileId/linkId are required'); } Prevention
- Validate the DTO before sending; never send blank chatId
- Make required fields explicit in the API contract/OpenAPI schema
- Populate fileId at bind time so unbind always has a reference
When it happens
Trigger: POST /unbind-file with a LongFileDto whose chatId is empty/null/whitespace, or with neither fileId nor linkId supplied.
Common situations: Frontend builds the DTO from state that was never populated (file not yet bound); API consumers omit optional-looking fields; stale client state after chat deletion wipes ids.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/f07ef481f520e766.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/controller/chat/ChatEnhanceController.java:98
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
* @return Operation result object
* @throws BusinessException Thrown when file information is missing or invalid
*/
@Operation(summary = "Unbind file's FileId and ChatId")
@PostMapping(path = "unbind-file")
public ApiResult<Object> unbindFile(@RequestBody LongFileDto longFileDto) {
if (StringUtils.isBlank(longFileDto.getChatId())) {
throw new BusinessException(ResponseEnum.LONG_CONTENT_MISS_FILE_INFO);
}
Long chatId = Long.valueOf(longFileDto.getChatId());
String fileId = longFileDto.getFileId();
String linkIdString = longFileDto.getLinkId();
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);View on GitHub (pinned to 5e758547a8)