{"record":{"id":"b1fbcb5f04ead725","repo":"iflytek/astron-agent","slug":"repo-file-slice-failed","errorCode":"REPO_FILE_SLICE_FAILED","errorMessage":"REPO_FILE_SLICE_FAILED","messagePattern":"REPO_FILE_SLICE_FAILED","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":1370,"sourceCode":"        params.put(\"isSplitDefault\", false);\n        params.put(\"splitType\", \"wiki\");\n\n        // Custom separators (base64)\n        JSONObject wiki = new JSONObject();\n        List<String> sep = Optional.ofNullable(vo.getSliceConfig().getSeperator()).orElseGet(ArrayList::new);\n        List<String> sep64 = new ArrayList<>();\n        for (String s : sep) {\n            sep64.add(Base64.getEncoder().encodeToString(s.getBytes(StandardCharsets.UTF_8)));\n        }\n        wiki.put(\"chunkSeparators\", sep64);\n        wiki.put(\"chunkSize\", vo.getSliceConfig().getLengthRange().get(1));\n        wiki.put(\"minChunkSize\", vo.getSliceConfig().getLengthRange().get(0));\n        params.put(\"wikiSplitExtends\", wiki);\n\n        String resp = OkHttpUtil.post(url, header, params.toJSONString());\n        JSONObject obj = JSONObject.parseObject(resp);\n        if (obj.getIntValue(\"code\") != 0) {\n            throw new BusinessException(ResponseEnum.REPO_FILE_SLICE_FAILED);\n        }\n    }\n\n    /**\n     * Parse failure retry: Reset/write directory tree → Validate range/separators → Set status to\n     * parsing → Execute slicing asynchronously (auto-trigger subsequent embedding)\n     *\n     * @param file file information object\n     * @param vo deal file parameters\n     * @param spaceId space ID for permission checking\n     * @param pool thread pool for async execution\n     * @throws BusinessException if file is currently being parsed or range is invalid\n     */\n    private void handleParseFailedRetry(FileInfoV2 file, DealFileVO vo, Long spaceId, ExecutorService pool) {\n        SliceConfig sc = normalizeAndValidateSliceConfig(vo);\n\n        // Permission validation (consistent with original logic: validate only when spaceId is null)\n        if (spaceId == null)","sourceCodeStart":1352,"sourceCodeEnd":1388,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java#L1352-L1388","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the slice HTTP response body in service logs to get the upstream code/message.","Verify the slice service URL from config category NODE_PREFIX_* is correct and the service is healthy.","Retry with a simpler/known-good slice configuration (e.g. default length range) to isolate config-driven rejections.","If transient, re-trigger the retry after the slice service recovers."],"exampleFix":"// before\nString resp = OkHttpUtil.post(url, header, params.toJSONString());\nJSONObject obj = JSONObject.parseObject(resp);\nif (obj.getIntValue(\"code\") != 0) {\n    throw new BusinessException(ResponseEnum.REPO_FILE_SLICE_FAILED);\n}\n// after\nString resp = OkHttpUtil.post(url, header, params.toJSONString());\nJSONObject obj = JSONObject.parseObject(resp);\nif (obj.getIntValue(\"code\") != 0) {\n    log.error(\"slice failed, url={}, code={}, msg={}\", url, obj.getIntValue(\"code\"), obj.getString(\"message\"));\n    throw new BusinessException(ResponseEnum.REPO_FILE_SLICE_FAILED,\n        \"slice service error: \" + obj.getString(\"message\"));\n}","handlingStrategy":"retry","validationCode":"// use a known-good config first\nList<Integer> range = vo.getSliceConfig().getLengthRange();\nif (range != null && range.size() == 2 && range.get(0) > 0 && range.get(0) <= range.get(1)) {\n    fileInfoV2Service.retry(vo, request);\n}","typeGuard":"boolean isSliceSuccess(String resp) {\n    try { return resp != null && JSONObject.parseObject(resp).getIntValue(\"code\") == 0; }\n    catch (Exception e) { return false; }\n}","tryCatchPattern":"try {\n    fileInfoV2Service.retry(vo, request);\n} catch (BusinessException e) {\n    if (e.getResponseEnum() == ResponseEnum.REPO_FILE_SLICE_FAILED) {\n        // retry once with default slice config, then surface upstream message\n        vo.setSliceConfig(defaultSliceConfig());\n        fileInfoV2Service.retry(vo, request);\n    } else { throw e; }\n}","preventionTips":["Check slice service health/URL config (NODE_PREFIX_*) before bulk retries.","Start with default slice parameters, then customize.","Log the full upstream slice response for diagnosis.","Apply exponential backoff for transient slice-service outages."],"tags":["java","spring-boot","http","slice","rag"],"backgroundTag":"upstream-api-error","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"}