iflytek/astron-agent · warning · BusinessException

REPO_KNOWLEDGE_SPLITTING

REPO_KNOWLEDGE_SPLITTING

Error message

REPO_KNOWLEDGE_SPLITTING

What it means

FileInfoV2Service throws REPO_KNOWLEDGE_SPLITTING when a retry is requested for a file whose current status is FILE_PARSE_DOING. The file is already being parsed/sliced, so starting another retry would race with the in-flight job; the service refuses with this business error instead.

Solutions

  1. Wait for the current parse to finish (poll the file status) before retrying.
  2. If the status is stuck in DOING with no running job (e.g. after a crash), reset the file status to failed/idle in the DB or via an admin path, then retry.
  3. Debounce/disable the retry button in the UI while file status is 'parsing'.

Example fix

// before
fileInfoV2Service.retry(vo, request); // may hit FILE_PARSE_DOING
// after
File file = fileMapper.selectById(fileId);
if (ProjectContent.FILE_PARSE_DOING.equals(file.getStatus())) {
    throw new IllegalStateException("file " + fileId + " is still parsing; retry later");
}
fileInfoV2Service.retry(vo, request);
Defensive patterns

Strategy: validation

Validate before calling

File f = fileMapper.selectById(fileId);
if (f != null && ProjectContent.FILE_PARSE_DOING.equals(f.getStatus())) {
    throw new IllegalStateException("file is currently parsing; wait before retry");
}

Type guard

boolean isParsing(File file) {
    return file != null && Objects.equals(file.getStatus(), ProjectContent.FILE_PARSE_DOING);
}

Try / catch

try {
    fileInfoV2Service.retry(vo, request);
} catch (BusinessException e) {
    if (e.getResponseEnum() == ResponseEnum.REPO_KNOWLEDGE_SPLITTING) {
        // poll status until done/failed, then retry
        awaitFileStatus(fileId, Duration.ofMinutes(5));
        fileInfoV2Service.retry(vo, request);
    } else { throw e; }
}

Prevention

When it happens

Trigger: Calling retry for a file whose DB row has status == ProjectContent.FILE_PARSE_DOING — i.e. a parse/slice job is currently running for that file.

Common situations: Double-clicking the retry button so the second request lands while the first is still processing; an async slice job is stuck in DOING status from a previous crash; polling UI retrying automatically before status flips to done/failed.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

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

     * 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)
            dataPermissionCheckTool.checkFileBelong(file);

        // Prohibit retry if currently parsing
        if (Objects.equals(file.getStatus(), ProjectContent.FILE_PARSE_DOING)) {
            throw new BusinessException(ResponseEnum.REPO_KNOWLEDGE_SPLITTING);
        }

        // AIUI slice range validation
        validateSliceRangeForAiui(sc, file.getSource());

        // Ensure directory tree existence
        ensureFileDirectoryTree(file);

        // Update slice configuration & set status to parsing
        file.setSliceConfig(JSON.toJSONString(sc));
        file.setCurrentSliceConfig(JSON.toJSONString(sc));
        file.setStatus(ProjectContent.FILE_PARSE_DOING);
        fileInfoV2Mapper.updateById(file);

        // Execute slicing task asynchronously (with backEmbedding flag set to 1)
        pool.execute(() -> new SliceFileTask(this, file.getId(), sc, 1).call());
    }

View on GitHub (pinned to 5e758547a8)