iflytek/astron-agent · error · BusinessException

REPO_KNOWLEDGE_MODIFY_FAILED

REPO_KNOWLEDGE_MODIFY_FAILED

Error message

ResponseEnum.REPO_KNOWLEDGE_MODIFY_FAILED

What it means

KnowledgeService updates a chunk via knowledgeV2ServiceCallHandler.updateChunk(request). If the upstream knowledge service answers with code != 0, it logs 'Failed to modify knowledge point' and throws BusinessException(REPO_KNOWLEDGE_MODIFY_FAILED). The code path also inspects response data for failedChunk entries afterwards, but a non-zero code short-circuits with this exception.

Solutions

  1. Check the log line 'Failed to modify knowledge point, message:{}' for the upstream reason.
  2. Re-list chunks for the docId and verify the chunkId still exists before retrying the update.
  3. Validate ragType/source and the resolved ragflowDatasetId match the file's current state.
  4. Retry after resolving conflicts; if the chunk is gone upstream, re-create it rather than updating.

Example fix

// before
KnowledgeResponse response = knowledgeV2ServiceCallHandler.updateChunk(request);
// code!=0 -> REPO_KNOWLEDGE_MODIFY_FAILED

// after
KnowledgeResponse response = knowledgeV2ServiceCallHandler.updateChunk(request);
if (response.getCode() != 0) {
    log.warn("updateChunk failed chunkId={} msg={}", chunkId, response.getMessage());
    // verify chunk still exists upstream / fix datasetId, then retry
}
Defensive patterns

Strategy: retry

Validate before calling

// verify chunk still exists before update
List<String> chunkIds = knowledgeService.listChunkIds(docId);
if (!chunkIds.contains(chunkId)) { /* re-create instead of update */ }

Try / catch

try {
    knowledgeService.updateChunk(request);
} catch (BusinessException e) {
    if (ResponseEnum.REPO_KNOWLEDGE_MODIFY_FAILED.getCode().equals(e.getCode())) {
        // re-list chunks; if missing, create; else retry after backoff
    } else { throw e; }
}

Prevention

When it happens

Trigger: updateChunk is called with a chunkId/docId the upstream service cannot modify: chunk already deleted upstream, invalid ragType or missing ragflowDatasetId, concurrent modification conflict, or upstream service error/timeout surfaced as a non-zero code.

Common situations: Two users editing the same knowledge point; chunk deleted by another flow between listing and update; RAGFlow dataset re-created so dataset IDs are stale; upstream knowledge service contract changed after an upgrade.

Related errors


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

Appendix: source

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

            JSONArray updateChunkArray) {
        List<String> resultList = new ArrayList<>();
        if (!updateChunkArray.isEmpty()) { // Delete document
            KnowledgeRequest request = new KnowledgeRequest();
            request.setDocId(docId);
            request.setGroup(group);
            request.setChunks(updateChunkArray.toArray());
            FileInfoV2 fileInfoV2 = fileInfoV2Service.getOnly(new QueryWrapper<FileInfoV2>().eq("uuid", docId));
            if (fileInfoV2 == null) {
                throw new BusinessException(ResponseEnum.REPO_FILE_NOT_EXIST);
            }

            request.setRagType(fileInfoV2.getSource());
            applyRagflowDatasetId(request, fileInfoV2.getSource(), datasetId);

            KnowledgeResponse response = knowledgeV2ServiceCallHandler.updateChunk(request);
            if (response.getCode() != 0) {
                log.error("Failed to modify knowledge point, message:{}", response.getMessage());
                throw new BusinessException(ResponseEnum.REPO_KNOWLEDGE_MODIFY_FAILED);
            }
            JSONObject data = (JSONObject) response.getData();
            if (data != null) {
                JSONObject failedChunk = data.getJSONObject("failedChunk");
                if (failedChunk != null) {
                    String errListStr = failedChunk.getString("chunkId");
                    if (!StringUtils.isEmpty(errListStr)) {
                        String[] errIds = errListStr.split(",");
                        log.error("failed repoId:{},  errIds:{}", group, errIds);
                        resultList = Arrays.asList(errIds);
                    }
                }
            }
        }
        return resultList;
    }

    /**

View on GitHub (pinned to 5e758547a8)