iflytek/astron-agent · error · BusinessException
LONG_CONTENT_FILE_SIZE_OUT_LIMIT
LONG_CONTENT_FILE_SIZE_OUT_LIMIT
Error message
LONG_CONTENT_FILE_SIZE_OUT_LIMIT
What it means
checkFile compares the uploaded file's size against limitEnum.getMaxSize() for the given business type. When fileSize exceeds that configured maximum, it throws LONG_CONTENT_FILE_SIZE_OUT_LIMIT, telling the user the document is too large for this chat long-content upload.
Solutions
- Compress or split the document so it is under the configured maxSize before uploading.
- Check ChatFileLimitEnum.getMaxSize() for the business type and inform the user of the exact allowed size.
- If the business requirement legitimately needs larger files, raise maxSize in the enum (considering nginx/gateway body limits too).
- Add a client-side size check that rejects oversize files before the upload request is made.
Example fix
// before
uploadFile(file); // server throws when file.length() > limit
// after
long maxBytes = ChatFileLimitEnum.DOCUMENT.getMaxSize();
if (file.length() > maxBytes) {
throw new IllegalArgumentException("File exceeds max size " + maxBytes + " bytes");
}
uploadFile(file); Defensive patterns
Strategy: validation
Validate before calling
long maxSize = ChatFileLimitEnum.DOCUMENT.getMaxSize();
if (file != null && file.getSize() > maxSize) {
throw new IllegalArgumentException("File exceeds " + maxSize + " bytes");
} Try / catch
try {
chatEnhanceService.saveFile(uid, fileName, fileUrl, fileSize, businessType);
} catch (BusinessException e) {
if (ResponseEnum.LONG_CONTENT_FILE_SIZE_OUT_LIMIT.equals(e.getResponseEnum())) {
// inform user of max allowed size and offer compression
}
} Prevention
- Pre-check file.size() against the published limit in the frontend before uploading.
- Expose maxSize per business type via a config API so clients stay in sync.
- Account for encoding overhead (base64/multipart) when computing size client-side.
When it happens
Trigger: Calling saveFile with a fileSize (in bytes) larger than the maxSize configured on the resolved ChatFileLimitEnum, e.g. uploading a 50MB PDF when the enum caps documents at 20MB.
Common situations: Users uploading large PDFs/Word docs through the chat document-upload feature; a frontend that computed size incorrectly (e.g. KB vs bytes); a limit enum that was tightened without updating client-side pre-checks; multipart encoding overhead pushing a borderline file over the limit.
Understand the failure class
Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/1999d6c345b99c3d.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/chat/impl/ChatEnhanceServiceImpl.java:226
*
* @param uid User ID
* @param fileName File name
* @param fileUrl File URL
* @param fileSize File size
* @param limitEnum File limit enum, including maximum file size and daily upload count limit
* @throws BusinessException Business exception thrown when file name or URL is empty, business type
* is wrong, file size exceeds limit or daily upload count exceeds limit
*/
private void checkFile(String uid, String fileName, String fileUrl, Long fileSize, ChatFileLimitEnum limitEnum) {
if (StringUtils.isBlank(fileName) || StringUtils.isBlank(fileUrl)) {
throw new BusinessException(ResponseEnum.LONG_CONTENT_MISS_FILE_INFO);
}
if (limitEnum == null) {
throw new BusinessException(ResponseEnum.LONG_CONTENT_WRONG_BUSINESS_TYPE);
}
// Current document size validation
if (fileSize > limitEnum.getMaxSize()) {
throw new BusinessException(ResponseEnum.LONG_CONTENT_FILE_SIZE_OUT_LIMIT);
}
// Daily maximum upload count limit
if (redissonClient.getAtomicLong(limitEnum.getRedisPrefix() + uid).addAndGet(1L) > limitEnum.getDailyUploadNum()) {
redissonClient.getAtomicLong(limitEnum.getRedisPrefix() + uid).addAndGet(-1L);
throw new BusinessException(ResponseEnum.LONG_CONTENT_FILE_NUM_OUT_LIMIT);
}
}
/**
* Handle document upload functionality
*
* @param chatFileUserId Chat file user ID
* @param uid User ID
* @param chatId Chat ID
* @param fileUrl File URL
* @param fileName File name
* @param fileSize File size
* @param limitEnum File limit enumView on GitHub (pinned to 5e758547a8)