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
- Check the log line 'Failed to modify knowledge point, message:{}' for the upstream reason.
- Re-list chunks for the docId and verify the chunkId still exists before retrying the update.
- Validate ragType/source and the resolved ragflowDatasetId match the file's current state.
- 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
- Re-list chunks immediately before update to catch concurrent deletes.
- Use optimistic concurrency or version fields for knowledge points.
- Log the upstream message on every non-zero response code.
- Validate ragType and datasetId after any RAGFlow dataset recreation.
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
- REPO_KNOWLEDGE_ADD_FAILED
- REPO_FILE_DELETE_FAILED
- REPO_KNOWLEDGE_DELETE_FAILED
- Timed out acquiring distributed lock, please try again later
- Distributed lock acquisition timeout, please try again later
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)