alibaba/nacos · error · IllegalArgumentException

editingVersion and reviewingVersion must identify different

Error message

editingVersion and reviewingVersion must identify different Versions

What it means

Thrown by validateVersionInfoCatalogConsistency when AgentVersionInfo.editingVersion equals reviewingVersion (both non-null). A single Version cannot be simultaneously in the editing and reviewing states; these are mutually exclusive lifecycle slots. The check fires only when editingVersion is non-null and equal to reviewingVersion.

Source

Thrown at api/src/main/java/com/alibaba/nacos/api/ai/utils/AgentModelValidator.java:417

        Map<String, String> labels = versionInfo.getLabels();
        requireNonNull(labels, "versionInfo.labels");
        for (Map.Entry<String, String> entry : labels.entrySet()) {
            AgentValidationUtils.validateLabel(entry.getKey());
            AgentValidationUtils.validateVersion(entry.getValue());
        }
    }
    
    private static void validateVersionInfoCatalogConsistency(AgentVersionInfo versionInfo,
        AgentVersionCatalog catalog) {
        List<AgentVersionCatalogEntry> onlineVersions = catalog.getOnlineVersions();
        if (versionInfo.getOnlineCnt() != onlineVersions.size()) {
            throw new IllegalArgumentException(
                "onlineCnt must equal the number of onlineVersions entries");
        }
        String editingVersion = versionInfo.getEditingVersion();
        String reviewingVersion = versionInfo.getReviewingVersion();
        if (editingVersion != null && editingVersion.equals(reviewingVersion)) {
            throw new IllegalArgumentException(
                "editingVersion and reviewingVersion must identify different Versions");
        }
        Set<String> onlineVersionValues = new HashSet<String>();
        for (AgentVersionCatalogEntry entry : onlineVersions) {
            onlineVersionValues.add(entry.getVersion());
        }
        if (onlineVersionValues.contains(editingVersion)
            || onlineVersionValues.contains(reviewingVersion)) {
            throw new IllegalArgumentException(
                "editingVersion and reviewingVersion must not identify online Versions");
        }
        for (Map.Entry<String, String> label : versionInfo.getLabels().entrySet()) {
            if (label.getValue().equals(editingVersion)
                || label.getValue().equals(reviewingVersion)) {
                throw new IllegalArgumentException(
                    "Labels must not identify editing or reviewing Versions");
            }
        }

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Ensure editingVersion and reviewingVersion reference different Version strings, or leave one null.
  2. When a Version moves from editing to reviewing, null out editingVersion rather than duplicating.
  3. Review any code path that assigns both fields from the same source value.

Example fix

// before
versionInfo.setEditingVersion("1.0.0"); versionInfo.setReviewingVersion("1.0.0");
// after
versionInfo.setEditingVersion(null); versionInfo.setReviewingVersion("1.0.0");
Defensive patterns

Strategy: validation

Validate before calling

static void checkEditingVsReviewing(AgentVersionInfo info) {
    String e = info.getEditingVersion(), r = info.getReviewingVersion();
    if (e != null && e.equals(r)) {
        throw new IllegalArgumentException(
            "editingVersion and reviewingVersion must identify different Versions");
    }
}

Type guard

static boolean editingAndReviewingDiffer(AgentVersionInfo info) {
    String e = info.getEditingVersion(), r = info.getReviewingVersion();
    return e == null || r == null || !e.equals(r);
}

Try / catch

try {
    AgentModelValidator.validateAgent(agent);
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("editingVersion and reviewingVersion must identify different")) {
        agent.getVersionInfo().setEditingVersion(null); // resolve conflict
    }
}

Prevention

When it happens

Trigger: Setting both editingVersion and reviewingVersion to the same Version string in one payload; copying one field into the other during a refactor.

Common situations: Promoting a Version and forgetting to clear the old slot; test fixtures that set both fields to the same constant for brevity.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/040c32eb53d30ac9. Report an issue: GitHub.