alibaba/nacos · error · IllegalArgumentException

editingVersion and reviewingVersion must not identify online

Error message

editingVersion and reviewingVersion must not identify online Versions

What it means

Thrown by validateVersionInfoCatalogConsistency when either editingVersion or reviewingVersion appears in the set of online Version values derived from versionCatalog.onlineVersions. A Version that is online cannot also be the editing or reviewing target; online is a terminal publish state distinct from the in-flight editing/reviewing slots.

Source

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

        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");
            }
        }
        String latestLabelVersion = versionInfo.getLabels().get("latest");
        if (catalog.getLatestVersion() == null) {
            if (latestLabelVersion != null) {
                throw new IllegalArgumentException(
                    "latest label must be absent when no online Version exists");
            }
        } else if (!catalog.getLatestVersion().equals(latestLabelVersion)) {
            throw new IllegalArgumentException(
                "latest label and versionCatalog.latestVersion must match");

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Remove the online Version from editingVersion/reviewingVersion, or remove it from onlineVersions if it is genuinely still in edit.
  2. Recompute editing/reviewing slots from the authoritative Version lifecycle after any online transition.
  3. Treat the catalog onlineVersions set as the source of truth and clear any overlapping edit/review pointers.

Example fix

// before
versionInfo.setEditingVersion("1.2.0"); catalog.setOnlineVersions(List.of(entryFor120));
// after
versionInfo.setEditingVersion(null); // 1.2.0 is online, not being edited
Defensive patterns

Strategy: validation

Validate before calling

static void checkEditReviewNotOnline(AgentVersionInfo info, AgentVersionCatalog catalog) {
    Set<String> online = new HashSet<>();
    for (var en : catalog.getOnlineVersions()) online.add(en.getVersion());
    String e = info.getEditingVersion(), r = info.getReviewingVersion();
    if ((e != null && online.contains(e)) || (r != null && online.contains(r))) {
        throw new IllegalArgumentException(
            "editingVersion and reviewingVersion must not identify online Versions");
    }
}

Type guard

static boolean editReviewNotOnline(AgentVersionInfo info, AgentVersionCatalog catalog) {
    Set<String> online = new HashSet<>();
    for (var en : catalog.getOnlineVersions()) online.add(en.getVersion());
    String e = info.getEditingVersion(), r = info.getReviewingVersion();
    return (e == null || !online.contains(e)) && (r == null || !online.contains(r));
}

Try / catch

try {
    AgentModelValidator.validateAgent(agent);
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("must not identify online Versions")) {
        // clear stale editing/reviewing pointers that overlap online set
    }
}

Prevention

When it happens

Trigger: Submitting a payload where the same Version string is both listed in onlineVersions and referenced as editingVersion or reviewingVersion.

Common situations: Re-publishing flow that keeps an old editingVersion pointer after the Version went online; merging a catalog snapshot with a stale versionInfo without reconciling the slots.

Related errors


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