iflytek/astron-agent · warning · BusinessException

LONG_CONTENT_WRONG_BUSINESS_TYPE

LONG_CONTENT_WRONG_BUSINESS_TYPE

Error message

LONG_CONTENT_WRONG_BUSINESS_TYPE

What it means

Thrown in ChatEnhanceServiceImpl.saveFile when ChatFileLimitEnum.checkFileByBusinessType(fileName, businessType) returns false, i.e. the file's extension/type is not allowed for the given businessType. It wraps ResponseEnum.LONG_CONTENT_WRONG_BUSINESS_TYPE and is the upload entry point's format/business-type guard.

Solutions

  1. Check ChatFileLimitEnum.checkFileByBusinessType to see which extensions are allowed for your businessType and upload a matching file.
  2. Verify the client sends the correct businessType for the file being uploaded.
  3. Ensure fileName includes a proper extension; rename the file if the extension is missing or wrong.
  4. If the type should be supported, extend the ChatFileLimitEnum allowed-extension mapping.

Example fix

// before
if (!ChatFileLimitEnum.checkFileByBusinessType(fileName, businessType)) {
    throw new BusinessException(ResponseEnum.LONG_CONTENT_WRONG_BUSINESS_TYPE);
}
// after
if (!ChatFileLimitEnum.checkFileByBusinessType(fileName, businessType)) {
    log.warn("File type not allowed for businessType: {}, fileName: {}", businessType, fileName);
    throw new BusinessException(ResponseEnum.LONG_CONTENT_WRONG_BUSINESS_TYPE);
}
Defensive patterns

Strategy: validation

Validate before calling

// Client-side pre-check mirroring the server rule:
if (!ChatFileLimitEnum.checkFileByBusinessType(fileName, businessType)) {
    throw new BusinessException(ResponseEnum.LONG_CONTENT_WRONG_BUSINESS_TYPE);
}

Try / catch

try {
    chatEnhanceService.saveFile(vo);
} catch (BusinessException e) {
    if (ResponseEnum.LONG_CONTENT_WRONG_BUSINESS_TYPE == e.getCode()) {
        // show allowed file types for this businessType to the user
    }
}

Prevention

When it happens

Trigger: saveFile(vo) reads fileName and businessType from the uploaded file VO; if the extension (from fileName) is not in the allowed set for that ChatFileLimitEnum business type, BusinessException(LONG_CONTENT_WRONG_BUSINESS_TYPE) is thrown before size/count checks run.

Common situations: Uploading a .exe/.zip or other disallowed extension to a chat that only accepts documents; sending a file with the wrong businessType value (e.g. audio-type businessType with a text document); fileName missing an extension so extension matching fails; client passing an out-of-range businessType integer.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — 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/e7ad905dd15633e6. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/chat/impl/ChatEnhanceServiceImpl.java:159

        return map;
    }

    /**
     * Save file and return file ID mapping
     *
     * @param uid User ID
     * @param vo Chat enhance file save object
     * @return Map containing file ID and error information
     */
    @Override
    public Map<String, String> saveFile(String uid, ChatEnhanceSaveFileVo vo) {
        String fileName = vo.getFileName();
        String fileUrl = vo.getFileUrl();
        Long fileSize = vo.getFileSize();
        Integer businessType = vo.getBusinessType();
        // File extension and file type validation
        if (!ChatFileLimitEnum.checkFileByBusinessType(fileName, businessType)) {
            throw new BusinessException(ResponseEnum.LONG_CONTENT_WRONG_BUSINESS_TYPE);
        }
        // Convert to file type, determine whether to use the institute's interface based on the presence of
        // fileBizType field
        ChatFileLimitEnum limitEnum = ChatFileLimitEnum.getByValue(businessType);
        checkFile(uid, fileName, fileUrl, fileSize, limitEnum);

        Map<String, String> fileIdMap = documentHandler(null, uid, vo.getChatId(), fileUrl, fileName, fileSize,
                limitEnum, vo.getFileBusinessKey(), vo.getDocumentType(), vo.getParamName());

        if (fileIdMap == null) {
            fileIdMap = new HashMap<>();
            fileIdMap.put("file_id", null);
            fileIdMap.put("error_msg", LongContextStatusEnum.FINALLY.getErrorMsg());
        }
        String fileId = fileIdMap.get("file_id");
        if (StringUtils.isBlank(fileId)) {
            fileIdMap.put("error_msg", LongContextStatusEnum.FINALLY.getErrorMsg());
        }

View on GitHub (pinned to 5e758547a8)