{"record":{"id":"2e6a49ec4905ede0","repo":"iflytek/astron-agent","slug":"long-content-miss-file-info-2e6a49","errorCode":"LONG_CONTENT_MISS_FILE_INFO","errorMessage":"LONG_CONTENT_MISS_FILE_INFO","messagePattern":"LONG_CONTENT_MISS_FILE_INFO","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"warning","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/chat/impl/ChatEnhanceServiceImpl.java","lineNumber":219,"sourceCode":"    public void delete(String fileId, Long chatId, String uid) {\n        chatDataService.deleteChatFileReq(fileId, chatId, uid);\n    }\n\n    /**\n     * Method to check files, validate if file name, URL and size are valid, and check if the number of\n     * uploaded files exceeds daily limit.\n     *\n     * @param uid User ID\n     * @param fileName File name\n     * @param fileUrl File URL\n     * @param fileSize File size\n     * @param limitEnum File limit enum, including maximum file size and daily upload count limit\n     * @throws BusinessException Business exception thrown when file name or URL is empty, business type\n     *         is wrong, file size exceeds limit or daily upload count exceeds limit\n     */\n    private void checkFile(String uid, String fileName, String fileUrl, Long fileSize, ChatFileLimitEnum limitEnum) {\n        if (StringUtils.isBlank(fileName) || StringUtils.isBlank(fileUrl)) {\n            throw new BusinessException(ResponseEnum.LONG_CONTENT_MISS_FILE_INFO);\n        }\n        if (limitEnum == null) {\n            throw new BusinessException(ResponseEnum.LONG_CONTENT_WRONG_BUSINESS_TYPE);\n        }\n        // Current document size validation\n        if (fileSize > limitEnum.getMaxSize()) {\n            throw new BusinessException(ResponseEnum.LONG_CONTENT_FILE_SIZE_OUT_LIMIT);\n        }\n        // Daily maximum upload count limit\n        if (redissonClient.getAtomicLong(limitEnum.getRedisPrefix() + uid).addAndGet(1L) > limitEnum.getDailyUploadNum()) {\n            redissonClient.getAtomicLong(limitEnum.getRedisPrefix() + uid).addAndGet(-1L);\n            throw new BusinessException(ResponseEnum.LONG_CONTENT_FILE_NUM_OUT_LIMIT);\n        }\n    }\n\n    /**\n     * Handle document upload functionality\n     *","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/chat/impl/ChatEnhanceServiceImpl.java#L201-L237","documentation":"Thrown in ChatEnhanceServiceImpl.checkFile (called from saveFile) when either fileName or fileUrl is blank. It wraps ResponseEnum.LONG_CONTENT_MISS_FILE_INFO and indicates the upload request lacks the minimal file metadata needed to validate and store the file.","triggerScenarios":"saveFile -> checkFile(uid, fileName, fileUrl, fileSize, limitEnum): StringUtils.isBlank(fileName) || StringUtils.isBlank(fileUrl) evaluates true, immediately throwing BusinessException(LONG_CONTENT_MISS_FILE_INFO) before size-limit and daily-count checks.","commonSituations":"Client uploaded to object storage but did not return the URL in the VO; upload flow partially failed so URL was never populated; frontend sent only fileSize/fileName but omitted fileUrl; serialization dropped the fileUrl field; empty-string filename from a zero-byte or unnamed upload.","solutions":["Ensure the upload flow completes and populates both fileName and fileUrl on the VO before calling saveFile.","Validate the client payload includes fileName and fileUrl; reject empty uploads client-side.","Check object-storage upload step for silent failures that leave fileUrl null.","Inspect the request body/serialization if fields are being dropped in transit."],"exampleFix":"// before\nif (StringUtils.isBlank(fileName) || StringUtils.isBlank(fileUrl)) {\n    throw new BusinessException(ResponseEnum.LONG_CONTENT_MISS_FILE_INFO);\n}\n// after\nif (StringUtils.isBlank(fileName) || StringUtils.isBlank(fileUrl)) {\n    log.warn(\"Missing file info, uid: {}, fileName blank: {}, fileUrl blank: {}\",\n            uid, StringUtils.isBlank(fileName), StringUtils.isBlank(fileUrl));\n    throw new BusinessException(ResponseEnum.LONG_CONTENT_MISS_FILE_INFO);\n}","handlingStrategy":"validation","validationCode":"// Guard before calling saveFile:\nif (vo == null || vo.getFileName() == null || vo.getFileName().isBlank()\n        || vo.getFileUrl() == null || vo.getFileUrl().isBlank()) {\n    throw new IllegalArgumentException(\"fileName and fileUrl are required\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    chatEnhanceService.saveFile(vo);\n} catch (BusinessException e) {\n    if (ResponseEnum.LONG_CONTENT_MISS_FILE_INFO == e.getCode()) {\n        // re-run the object-storage upload to obtain fileUrl, then retry\n    }\n}","preventionTips":["Verify the object-storage upload succeeded and returned a URL before saveFile.","Make fileUrl non-optional in the upload DTO.","Fail fast client-side on missing file metadata."],"tags":["file-upload","missing-field","validation","chat"],"backgroundTag":"empty-required-field","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}