{"record":{"id":"dff4b4e7b3079089","repo":"iflytek/astron-agent","slug":"repo-file-slice-range-16-1024","errorCode":"REPO_FILE_SLICE_RANGE_16_1024","errorMessage":"REPO_FILE_SLICE_RANGE_16_1024","messagePattern":"REPO_FILE_SLICE_RANGE_16_1024","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java","lineNumber":1522,"sourceCode":"        ensureSeparatorDefault(sc);\n        return sc;\n    }\n\n    /**\n     * AIUI slice range restriction ([16, 1024]), skip for other sources\n     *\n     * @param sc slice configuration to validate\n     * @param source file source type\n     * @throws BusinessException if range is invalid for AIUI source\n     */\n    private void validateSliceRangeForAiui(SliceConfig sc, String source) {\n        if (!ProjectContent.isAiuiRagCompatible(source)\n                || CollectionUtils.isEmpty(sc.getLengthRange()))\n            return;\n        Integer min = sc.getLengthRange().get(0);\n        Integer max = sc.getLengthRange().get(1);\n        if (min < 16 || max > 1024) {\n            throw new BusinessException(ResponseEnum.REPO_FILE_SLICE_RANGE_16_1024);\n        }\n    }\n\n    /**\n     * Ensure directory tree record exists (insert one if not exists)\n     *\n     * @param file file information object containing repo and file details\n     */\n    private void ensureFileDirectoryTree(FileInfoV2 file) {\n        FileDirectoryTree tree = fileDirectoryTreeService.getOnly(\n                Wrappers.lambdaQuery(FileDirectoryTree.class)\n                        .eq(FileDirectoryTree::getAppId, file.getRepoId())\n                        .eq(FileDirectoryTree::getFileId, file.getId()));\n        if (tree == null) {\n            tree = new FileDirectoryTree();\n            tree.setIsFile(1);\n            tree.setName(file.getName());\n            tree.setAppId(file.getRepoId().toString());","sourceCodeStart":1504,"sourceCodeEnd":1540,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java#L1504-L1540","documentation":"validateSliceRangeForAiui throws REPO_FILE_SLICE_RANGE_16_1024 when a file sourced from AIUI RAG is retried with a slice lengthRange whose minimum is below 16 or whose maximum exceeds 1024. AIUI-compatible sources enforce this fixed chunk-size window; other sources skip the check entirely.","triggerScenarios":"Calling retry for an AIUI-compatible file (ProjectContent.isAiuiRagCompatible(source) true) with sliceConfig.lengthRange = [min, max] where min < 16 or max > 1024, e.g. [8, 512] or [16, 2048].","commonSituations":"User typing a custom chunk size outside AIUI's limits; range carried over from a non-AIUI file's config; UI not clamping the slider for AIUI-sourced files.","solutions":["Clamp the range to min >= 16 and max <= 1024 before submitting for AIUI files.","Reset to AIUI's default slice range if unsure.","Update the UI to restrict the allowed range when the file source is AIUI."],"exampleFix":"// before\nsliceConfig.setLengthRange(Arrays.asList(8, 2048)); // violates AIUI 16..1024\n// after\nint min = Math.max(16, requestedMin);\nint max = Math.min(1024, requestedMax);\nif (min > max) min = 16;\nsliceConfig.setLengthRange(Arrays.asList(min, max));","handlingStrategy":"validation","validationCode":"if (ProjectContent.isAiuiRagCompatible(file.getSource())\n    && vo.getSliceConfig().getLengthRange() != null) {\n    int min = vo.getSliceConfig().getLengthRange().get(0);\n    int max = vo.getSliceConfig().getLengthRange().get(1);\n    if (min < 16 || max > 1024) {\n        return ResponseEntity.badRequest().body(\"AIUI slice range must be within [16, 1024]\");\n    }\n}","typeGuard":"boolean isAiuiCompliantRange(String source, List<Integer> range) {\n    if (!ProjectContent.isAiuiRagCompatible(source) || range == null || range.isEmpty()) return true;\n    return range.get(0) >= 16 && range.get(1) <= 1024;\n}","tryCatchPattern":"try {\n    fileInfoV2Service.retry(vo, request);\n} catch (BusinessException e) {\n    if (e.getResponseEnum() == ResponseEnum.REPO_FILE_SLICE_RANGE_16_1024) {\n        vo.getSliceConfig().setLengthRange(Arrays.asList(16, 1024)); // clamp to AIUI limits\n        fileInfoV2Service.retry(vo, request);\n    } else { throw e; }\n}","preventionTips":["Clamp the range input to 16..1024 in the UI whenever the file source is AIUI.","Branch validation logic on file source, not just on slice type.","Document the AIUI chunk-size window where users configure slicing."],"tags":["java","spring-boot","validation","aiui","range"],"backgroundTag":"value-out-of-range","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"}