iflytek/astron-agent · error · BusinessException

REPO_TYPE_NOT_MATCH

REPO_TYPE_NOT_MATCH

Error message

ResponseEnum.REPO_TYPE_NOT_MATCH

What it means

RepoService.validateTag throws REPO_TYPE_NOT_MATCH when a knowledge-base tag is neither CBG-RAG-compatible nor AIUI-RAG-compatible. The tag field of the incoming RepoVO must match one of the supported RAG types (checked via ProjectContent.isCbgRagCompatible/isAiuiRagCompatible); anything else is rejected at creation time by createRepo. This is an input-validation guard protecting downstream RAG integration code that only knows how to handle the supported tag families.

Solutions

  1. Set repoVO.tag to one of the supported RAG tag constants defined in ProjectContent (CBG-RAG or AIUI-RAG compatible values)
  2. Check ProjectContent.isCbgRagCompatible / isAiuiRagCompatible in the client to validate the tag before calling createRepo
  3. If the tag comes from an upstream enum/dictionary, sync it with the current ProjectContent constants (values may have been renamed)
  4. Log the actual tag value at the call site to catch silent null/empty tags

Example fix

// before
RepoVO vo = new RepoVO();
vo.setName("kb");
vo.setTag("custom-rag"); // unsupported
repoService.createRepo(vo);
// after
RepoVO vo = new RepoVO();
vo.setName("kb");
vo.setTag(ProjectContent.FILE_SOURCE_RAG_FLOW_RAG_STR); // a supported tag
repoService.createRepo(vo);
Defensive patterns

Strategy: validation

Validate before calling

if (!ProjectContent.isCbgRagCompatible(tag) && !ProjectContent.isAiuiRagCompatible(tag)) {
    throw new IllegalArgumentException("Unsupported RAG tag: " + tag);
}
repoService.createRepo(vo);

Type guard

boolean isValidRagTag(String tag) {
    return tag != null && (ProjectContent.isCbgRagCompatible(tag) || ProjectContent.isAiuiRagCompatible(tag));
}

Try / catch

try {
    repoService.createRepo(vo);
} catch (BusinessException e) {
    if ("REPO_TYPE_NOT_MATCH".equals(e.getCode())) {
        // prompt user to select a supported RAG type
    }
}

Prevention

When it happens

Trigger: Calling createRepo with a RepoVO whose tag is absent, empty, or set to an unsupported string (e.g. a legacy tag, typo like 'rag-flow-rag' vs FILE_SOURCE_RAG_FLOW_RAG_STR, or a tag from a different product line).

Common situations: API consumers hardcoding a tag copied from docs of another version; scripts creating repos in bulk with a default tag value that no longer exists after a rename in ProjectContent; frontend sending tag=null when the create form omits the RAG type selector.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

    }

    /** Reject duplicate repo names in the current personal or space scope. */
    private void validateRepoNameUnique(RepoVO repoVO, Long spaceId) {
        Repo existRepo;
        if (spaceId == null) {
            existRepo = this.getOnly(Wrappers.lambdaQuery(Repo.class).eq(Repo::getUserId, UserInfoManagerHandler.getUserId()).eq(Repo::getName, repoVO.getName()).eq(Repo::getDeleted, 0));
        } else {
            existRepo = this.getOnly(Wrappers.lambdaQuery(Repo.class).eq(Repo::getSpaceId, spaceId).eq(Repo::getName, repoVO.getName()).eq(Repo::getDeleted, 0));
        }
        if (existRepo != null) {
            throw new BusinessException(ResponseEnum.REPO_NAME_DUPLICATE);
        }
    }

    /** Reject unsupported RAG tags. */
    private void validateTag(String tag) {
        if (!ProjectContent.isCbgRagCompatible(tag) && !ProjectContent.isAiuiRagCompatible(tag)) {
            throw new BusinessException(ResponseEnum.REPO_TYPE_NOT_MATCH);
        }
    }

    /** Ragflow-RAG always uses a server-generated core repo id. */
    private String resolveCoreRepoId(RepoVO repoVO) {
        if (ProjectContent.FILE_SOURCE_RAG_FLOW_RAG_STR.equals(repoVO.getTag())) {
            return UUID.randomUUID().toString().replace("-", "");
        }
        if (StringUtils.isEmpty(repoVO.getOuterRepoId())) {
            return UUID.randomUUID().toString().replace("-", "");
        }
        return repoVO.getOuterRepoId();
    }

    /** Build {@code repoName-coreRepoId}, trimming only the readable prefix. */
    private String buildRagflowDatasetName(String repoName, String coreRepoId) {
        String suffix = coreRepoId;
        String readableName = StringUtils.defaultIfBlank(repoName, "repo").trim();

View on GitHub (pinned to 5e758547a8)