{"record":{"id":"454c6c884fa3a467","repo":"iflytek/astron-agent","slug":"repo-knowledge-all-embedding-failed","errorCode":"REPO_KNOWLEDGE_ALL_EMBEDDING_FAILED","errorMessage":"REPO_KNOWLEDGE_ALL_EMBEDDING_FAILED","messagePattern":"REPO_KNOWLEDGE_ALL_EMBEDDING_FAILED","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"critical","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/KnowledgeService.java","lineNumber":1194,"sourceCode":"                        log.error(\"Failed to get CBG task result\", e);\n                    }\n                }\n            } finally {\n                pool.shutdown();\n            }\n            return r;\n        }\n\n        // Unknown source: no external push\n        return r;\n    }\n\n    private void applyPushResult(List<Knowledge> knowledgeList, List<Knowledge> oldAuto, PushResult push, Long fileId) {\n        if (ProjectContent.isAiuiRagCompatible(push.source)) {\n            // Throw error if all failed\n            if (!push.failedKnowledge.isEmpty() && push.failedKnowledge.size() >= knowledgeList.size()) {\n                log.error(\"All knowledge points embedding failed, fileId:{}, failed:{}, total:{}\", fileId, push.failedKnowledge.size(), knowledgeList.size());\n                throw new BusinessException(ResponseEnum.REPO_KNOWLEDGE_ALL_EMBEDDING_FAILED);\n            }\n            if (!CollectionUtils.isEmpty(push.failedKnowledge)) {\n                for (Knowledge k : knowledgeList) {\n                    if (push.failedKnowledge.contains(k.getId())) {\n                        k.setEnabled(0);\n                    }\n                }\n            }\n            return;\n        }\n\n        if (ProjectContent.isCbgRagCompatible(push.source)) {\n            // Map dataIndex -> id back to Knowledge.id\n            for (Knowledge k : knowledgeList) {\n                String dataIndex = k.getContent().getString(\"dataIndex\");\n                k.setId(push.cbgKnowledgeMap.get(dataIndex));\n            }\n            // CBG scenario: will delete oldAuto and save new data later, logic consistent with original","sourceCodeStart":1176,"sourceCodeEnd":1212,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/KnowledgeService.java#L1176-L1212","documentation":"BusinessException REPO_KNOWLEDGE_ALL_EMBEDDING_FAILED thrown by applyPushResult when, for an AIUI-RAG compatible source, every knowledge point sent to the external embedding/knowledge service failed (failedKnowledge.size() >= knowledgeList.size()). A total failure means nothing was embedded, so the operation is aborted rather than partially applied. Partial failures are tolerated by disabling only the failed points.","triggerScenarios":"Confirm/embed flow (pushChunksBySource -> addKnowledge4AIUI) where every batch insert into the AIUI knowledge base failed — e.g., AIUI service down, auth/token invalid, dataset id wrong, request payloads rejected (size/format), or network timeouts causing each batch's exception to mark its chunk ids failed.","commonSituations":"AIUI RAG endpoint credentials expired or quota exhausted. Wrong ragflowDatasetId/coreRepoId configured for the repo. Large documents whose chunks exceed AIUI batch limits. Network partition between console backend and AIUI service.","solutions":["Check AIUI service health/credentials: validate API key/token and that the target dataset still exists.","Inspect logs for the per-batch errors from addKnowledge4AIUI (they precede this aggregate error) to find the root failure (auth vs. payload vs. network).","Retry the embed/confirm operation after the external service recovers; state on the local side is only changed after this throw.","Reduce maxSaveCount batch size if payloads are being rejected for size, and verify chunk contents for invalid characters."],"exampleFix":"// before\nif (!push.failedKnowledge.isEmpty() && push.failedKnowledge.size() >= knowledgeList.size()) {\n    throw new BusinessException(ResponseEnum.REPO_KNOWLEDGE_ALL_EMBEDDING_FAILED);\n}\n// after (bounded retry before giving up)\nif (allFailed && retryCount < MAX_RETRIES) {\n    push = pushChunksBySource(fileId, uuid, addArray); // retry batch\n} else if (allFailed) {\n    throw new BusinessException(ResponseEnum.REPO_KNOWLEDGE_ALL_EMBEDDING_FAILED);\n}","handlingStrategy":"retry","validationCode":"// before embedding, ping the AIUI endpoint\ndatasetHealth = knowledgeV2ServiceCallHandler.checkDataset(coreRepoId, ragflowDatasetId);\nif (!datasetHealth.isOk()) { alertOps(); return; }","typeGuard":null,"tryCatchPattern":"try { embeddingFlow.confirm(fileId); } catch (BusinessException e) { if (\"REPO_KNOWLEDGE_ALL_EMBEDDING_FAILED\".equals(e.getCode())) { scheduleRetryWithBackoff(fileId); } else { throw e; } }","preventionTips":["Monitor AIUI service health and credentials; alert before quota exhaustion.","Cap batch size (maxSaveCount) to stay within external API limits.","Check per-batch errors in logs (addKnowledge4AIUI) to distinguish auth vs payload vs network causes."],"tags":["embedding","aiui","external-service","rag","batch-failure"],"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"}