iflytek/astron-agent · error · BusinessException

REPO_FILE_SLICE_FAILED

REPO_FILE_SLICE_FAILED

Error message

REPO_FILE_SLICE_FAILED

What it means

This is thrown when the custom-splitting (Spark RAG slice) HTTP call returns a non-zero code in its JSON response. After posting the slice parameters (including wikiSplitExtends with minChunkSize) via OkHttpUtil, the service parses the reply and treats any code != 0 from the slicing service as a slicing failure.

Solutions

  1. Inspect the slice HTTP response body in service logs to get the upstream code/message.
  2. Verify the slice service URL from config category NODE_PREFIX_* is correct and the service is healthy.
  3. Retry with a simpler/known-good slice configuration (e.g. default length range) to isolate config-driven rejections.
  4. If transient, re-trigger the retry after the slice service recovers.

Example fix

// before
String resp = OkHttpUtil.post(url, header, params.toJSONString());
JSONObject obj = JSONObject.parseObject(resp);
if (obj.getIntValue("code") != 0) {
    throw new BusinessException(ResponseEnum.REPO_FILE_SLICE_FAILED);
}
// after
String resp = OkHttpUtil.post(url, header, params.toJSONString());
JSONObject obj = JSONObject.parseObject(resp);
if (obj.getIntValue("code") != 0) {
    log.error("slice failed, url={}, code={}, msg={}", url, obj.getIntValue("code"), obj.getString("message"));
    throw new BusinessException(ResponseEnum.REPO_FILE_SLICE_FAILED,
        "slice service error: " + obj.getString("message"));
}
Defensive patterns

Strategy: retry

Validate before calling

// use a known-good config first
List<Integer> range = vo.getSliceConfig().getLengthRange();
if (range != null && range.size() == 2 && range.get(0) > 0 && range.get(0) <= range.get(1)) {
    fileInfoV2Service.retry(vo, request);
}

Type guard

boolean isSliceSuccess(String resp) {
    try { return resp != null && JSONObject.parseObject(resp).getIntValue("code") == 0; }
    catch (Exception e) { return false; }
}

Try / catch

try {
    fileInfoV2Service.retry(vo, request);
} catch (BusinessException e) {
    if (e.getResponseEnum() == ResponseEnum.REPO_FILE_SLICE_FAILED) {
        // retry once with default slice config, then surface upstream message
        vo.setSliceConfig(defaultSliceConfig());
        fileInfoV2Service.retry(vo, request);
    } else { throw e; }
}

Prevention

When it happens

Trigger: Calling the parse-failure retry flow for a Spark-compatible file where the remote slicing endpoint returns {"code": <non-zero>} — e.g. invalid slice config, oversized file, or internal slice-service error.

Common situations: Slice service is degraded or misconfigured (wrong NODE_PREFIX url config); lengthRange/minChunkSize values the service rejects; file content the slicer cannot parse; transient upstream outage.

Related errors


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

Appendix: source

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

        params.put("isSplitDefault", false);
        params.put("splitType", "wiki");

        // Custom separators (base64)
        JSONObject wiki = new JSONObject();
        List<String> sep = Optional.ofNullable(vo.getSliceConfig().getSeperator()).orElseGet(ArrayList::new);
        List<String> sep64 = new ArrayList<>();
        for (String s : sep) {
            sep64.add(Base64.getEncoder().encodeToString(s.getBytes(StandardCharsets.UTF_8)));
        }
        wiki.put("chunkSeparators", sep64);
        wiki.put("chunkSize", vo.getSliceConfig().getLengthRange().get(1));
        wiki.put("minChunkSize", vo.getSliceConfig().getLengthRange().get(0));
        params.put("wikiSplitExtends", wiki);

        String resp = OkHttpUtil.post(url, header, params.toJSONString());
        JSONObject obj = JSONObject.parseObject(resp);
        if (obj.getIntValue("code") != 0) {
            throw new BusinessException(ResponseEnum.REPO_FILE_SLICE_FAILED);
        }
    }

    /**
     * Parse failure retry: Reset/write directory tree → Validate range/separators → Set status to
     * parsing → Execute slicing asynchronously (auto-trigger subsequent embedding)
     *
     * @param file file information object
     * @param vo deal file parameters
     * @param spaceId space ID for permission checking
     * @param pool thread pool for async execution
     * @throws BusinessException if file is currently being parsed or range is invalid
     */
    private void handleParseFailedRetry(FileInfoV2 file, DealFileVO vo, Long spaceId, ExecutorService pool) {
        SliceConfig sc = normalizeAndValidateSliceConfig(vo);

        // Permission validation (consistent with original logic: validate only when spaceId is null)
        if (spaceId == null)

View on GitHub (pinned to 5e758547a8)