iflytek/astron-agent · error · BusinessException
REPO_STATUS_ILLEGAL
REPO_STATUS_ILLEGAL
Error message
REPO_STATUS_ILLEGAL
What it means
BusinessException REPO_STATUS_ILLEGAL thrown by resolveRagflowDatasetIdOrNull when a file whose source is Ragflow-RAG has a null repoId on its FileInfoV2 record. For Ragflow-RAG sources the repoId is mandatory because dataset routing is resolved via the owning Repo; without it the resolver cannot determine which ragflow dataset to target.
Solutions
- Fix the data: UPDATE file_info_v2 SET repo_id = <correct repo id> WHERE id = <fileId> for Ragflow-RAG files.
- Ensure the file creation/import flow always sets repoId when source is Ragflow-RAG; add a validation on write.
- If the file is not truly Ragflow-RAG, correct the source field so the resolver short-circuits to null.
- Audit legacy rows: SELECT id FROM file_info_v2 WHERE source='ragflow' AND repo_id IS NULL.
Example fix
// before
Long repoId = fileInfoV2.getRepoId(); // null -> REPO_STATUS_ILLEGAL
// after (guard at write time)
if (ProjectContent.FILE_SOURCE_RAG_FLOW_RAG_STR.equals(fileInfoV2.getSource()) && fileInfoV2.getRepoId() == null) {
throw new IllegalArgumentException("repoId required for Ragflow-RAG file " + fileInfoV2.getId());
}
fileInfoV2Service.save(fileInfoV2); Defensive patterns
Strategy: validation
Validate before calling
if (ProjectContent.FILE_SOURCE_RAG_FLOW_RAG_STR.equals(fileInfoV2.getSource())) {
if (fileInfoV2.getRepoId() == null) { repairRepoIdOrReject(fileInfoV2); }
} Try / catch
try { datasetId = resolveRagflowDatasetIdOrNull(fileInfoV2); } catch (BusinessException e) { log.warn("invalid ragflow metadata, using default routing"); datasetId = null; } Prevention
- Always set repo_id when writing Ragflow-RAG FileInfoV2 rows.
- Add a NOT NULL constraint or application-level check for repo_id on ragflow-source files.
- Audit legacy rows after enabling Ragflow-RAG support.
When it happens
Trigger: Any document split/delete path (e.g., doUrlSplit, applyRagflowDatasetIdForDelete) on a FileInfoV2 where source == FILE_SOURCE_RAG_FLOW_RAG_STR but repoId is null. Typically caused by files imported/copied without repoId, or Ragflow source set on a file created by a flow that does not assign a repo.
Common situations: Data migration or script inserted Ragflow-RAG files without setting repo_id. A repo was unbound and repoId zeroed out. Code newly introduced the Ragflow-RAG requirement while legacy rows predate it. Note: applyRagflowDatasetIdForDelete catches this exception and skips delete, but split paths let it propagate.
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
- CHAT_TREE_ERROR
- REPO_CREATE_RAGFLOW_FAILED
- REPO_FILE_EMBEDDING_FAILED
- REPO_FILE_SLICE_FAILED
- REPO_KNOWLEDGE_ADD_FAILED
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/abd4267f5df5eb3b.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/KnowledgeService.java:595
return knowledgeV2ServiceCallHandler.documentSplit(request, datasetId);
}
/** Return ragflow_dataset_id for Ragflow-RAG; null keeps default dataset routing. */
private String resolveRagflowDatasetIdOrNull(FileInfoV2 fileInfoV2) {
return resolveRagflowDatasetIdOrNull(fileInfoV2, null);
}
/** Same resolver with an optional repoId -> datasetId cache. */
private String resolveRagflowDatasetIdOrNull(FileInfoV2 fileInfoV2,
Map<Long, String> repoIdToDatasetId) {
if (!ProjectContent.FILE_SOURCE_RAG_FLOW_RAG_STR.equals(fileInfoV2.getSource())) {
return null;
}
Long repoId = fileInfoV2.getRepoId();
if (repoId == null) {
log.error("Ragflow-RAG file requires repoId on FileInfoV2 id={}",
fileInfoV2.getId());
throw new BusinessException(ResponseEnum.REPO_STATUS_ILLEGAL);
}
if (repoIdToDatasetId != null && repoIdToDatasetId.containsKey(repoId)) {
// Preserve cached null values for repos without ragflowDatasetId.
return repoIdToDatasetId.get(repoId);
}
Repo repo = repoService.getById(repoId);
if (repo == null) {
log.error("Repo not found for repoId={}", repoId);
throw new BusinessException(ResponseEnum.REPO_STATUS_ILLEGAL);
}
String datasetId = repo.getRagflowDatasetId();
if (repoIdToDatasetId != null) {
repoIdToDatasetId.put(repoId, datasetId);
}
return datasetId;
}
private boolean applyRagflowDatasetIdForDelete(KnowledgeRequest request, FileInfoV2 fileInfoV2) {View on GitHub (pinned to 5e758547a8)