iflytek/astron-agent · error · BusinessException

REPO_FILE_SLICE_RANGE_16_1024

REPO_FILE_SLICE_RANGE_16_1024

Error message

REPO_FILE_SLICE_RANGE_16_1024

What it means

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.

Solutions

  1. Clamp the range to min >= 16 and max <= 1024 before submitting for AIUI files.
  2. Reset to AIUI's default slice range if unsure.
  3. Update the UI to restrict the allowed range when the file source is AIUI.

Example fix

// before
sliceConfig.setLengthRange(Arrays.asList(8, 2048)); // violates AIUI 16..1024
// after
int min = Math.max(16, requestedMin);
int max = Math.min(1024, requestedMax);
if (min > max) min = 16;
sliceConfig.setLengthRange(Arrays.asList(min, max));
Defensive patterns

Strategy: validation

Validate before calling

if (ProjectContent.isAiuiRagCompatible(file.getSource())
    && vo.getSliceConfig().getLengthRange() != null) {
    int min = vo.getSliceConfig().getLengthRange().get(0);
    int max = vo.getSliceConfig().getLengthRange().get(1);
    if (min < 16 || max > 1024) {
        return ResponseEntity.badRequest().body("AIUI slice range must be within [16, 1024]");
    }
}

Type guard

boolean isAiuiCompliantRange(String source, List<Integer> range) {
    if (!ProjectContent.isAiuiRagCompatible(source) || range == null || range.isEmpty()) return true;
    return range.get(0) >= 16 && range.get(1) <= 1024;
}

Try / catch

try {
    fileInfoV2Service.retry(vo, request);
} catch (BusinessException e) {
    if (e.getResponseEnum() == ResponseEnum.REPO_FILE_SLICE_RANGE_16_1024) {
        vo.getSliceConfig().setLengthRange(Arrays.asList(16, 1024)); // clamp to AIUI limits
        fileInfoV2Service.retry(vo, request);
    } else { throw e; }
}

Prevention

When it happens

Trigger: 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].

Common situations: 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.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/dff4b4e7b3079089. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java:1522

        ensureSeparatorDefault(sc);
        return sc;
    }

    /**
     * AIUI slice range restriction ([16, 1024]), skip for other sources
     *
     * @param sc slice configuration to validate
     * @param source file source type
     * @throws BusinessException if range is invalid for AIUI source
     */
    private void validateSliceRangeForAiui(SliceConfig sc, String source) {
        if (!ProjectContent.isAiuiRagCompatible(source)
                || CollectionUtils.isEmpty(sc.getLengthRange()))
            return;
        Integer min = sc.getLengthRange().get(0);
        Integer max = sc.getLengthRange().get(1);
        if (min < 16 || max > 1024) {
            throw new BusinessException(ResponseEnum.REPO_FILE_SLICE_RANGE_16_1024);
        }
    }

    /**
     * Ensure directory tree record exists (insert one if not exists)
     *
     * @param file file information object containing repo and file details
     */
    private void ensureFileDirectoryTree(FileInfoV2 file) {
        FileDirectoryTree tree = fileDirectoryTreeService.getOnly(
                Wrappers.lambdaQuery(FileDirectoryTree.class)
                        .eq(FileDirectoryTree::getAppId, file.getRepoId())
                        .eq(FileDirectoryTree::getFileId, file.getId()));
        if (tree == null) {
            tree = new FileDirectoryTree();
            tree.setIsFile(1);
            tree.setName(file.getName());
            tree.setAppId(file.getRepoId().toString());

View on GitHub (pinned to 5e758547a8)