{"record":{"id":"fd65e9c0b5486c34","repo":"alibaba/nacos","slug":"editingversion-and-reviewingversion-must-not-ident","errorCode":null,"errorMessage":"editingVersion and reviewingVersion must not identify online Versions","messagePattern":"editingVersion and reviewingVersion must not identify online Versions","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/com/alibaba/nacos/api/ai/utils/AgentModelValidator.java","lineNumber":426,"sourceCode":"        AgentVersionCatalog catalog) {\n        List<AgentVersionCatalogEntry> onlineVersions = catalog.getOnlineVersions();\n        if (versionInfo.getOnlineCnt() != onlineVersions.size()) {\n            throw new IllegalArgumentException(\n                \"onlineCnt must equal the number of onlineVersions entries\");\n        }\n        String editingVersion = versionInfo.getEditingVersion();\n        String reviewingVersion = versionInfo.getReviewingVersion();\n        if (editingVersion != null && editingVersion.equals(reviewingVersion)) {\n            throw new IllegalArgumentException(\n                \"editingVersion and reviewingVersion must identify different Versions\");\n        }\n        Set<String> onlineVersionValues = new HashSet<String>();\n        for (AgentVersionCatalogEntry entry : onlineVersions) {\n            onlineVersionValues.add(entry.getVersion());\n        }\n        if (onlineVersionValues.contains(editingVersion)\n            || onlineVersionValues.contains(reviewingVersion)) {\n            throw new IllegalArgumentException(\n                \"editingVersion and reviewingVersion must not identify online Versions\");\n        }\n        for (Map.Entry<String, String> label : versionInfo.getLabels().entrySet()) {\n            if (label.getValue().equals(editingVersion)\n                || label.getValue().equals(reviewingVersion)) {\n                throw new IllegalArgumentException(\n                    \"Labels must not identify editing or reviewing Versions\");\n            }\n        }\n        String latestLabelVersion = versionInfo.getLabels().get(\"latest\");\n        if (catalog.getLatestVersion() == null) {\n            if (latestLabelVersion != null) {\n                throw new IllegalArgumentException(\n                    \"latest label must be absent when no online Version exists\");\n            }\n        } else if (!catalog.getLatestVersion().equals(latestLabelVersion)) {\n            throw new IllegalArgumentException(\n                \"latest label and versionCatalog.latestVersion must match\");","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/api/src/main/java/com/alibaba/nacos/api/ai/utils/AgentModelValidator.java#L408-L444","documentation":"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.","triggerScenarios":"Submitting a payload where the same Version string is both listed in onlineVersions and referenced as editingVersion or reviewingVersion.","commonSituations":"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.","solutions":["Remove the online Version from editingVersion/reviewingVersion, or remove it from onlineVersions if it is genuinely still in edit.","Recompute editing/reviewing slots from the authoritative Version lifecycle after any online transition.","Treat the catalog onlineVersions set as the source of truth and clear any overlapping edit/review pointers."],"exampleFix":"// before\nversionInfo.setEditingVersion(\"1.2.0\"); catalog.setOnlineVersions(List.of(entryFor120));\n// after\nversionInfo.setEditingVersion(null); // 1.2.0 is online, not being edited","handlingStrategy":"validation","validationCode":"static void checkEditReviewNotOnline(AgentVersionInfo info, AgentVersionCatalog catalog) {\n    Set<String> online = new HashSet<>();\n    for (var en : catalog.getOnlineVersions()) online.add(en.getVersion());\n    String e = info.getEditingVersion(), r = info.getReviewingVersion();\n    if ((e != null && online.contains(e)) || (r != null && online.contains(r))) {\n        throw new IllegalArgumentException(\n            \"editingVersion and reviewingVersion must not identify online Versions\");\n    }\n}","typeGuard":"static boolean editReviewNotOnline(AgentVersionInfo info, AgentVersionCatalog catalog) {\n    Set<String> online = new HashSet<>();\n    for (var en : catalog.getOnlineVersions()) online.add(en.getVersion());\n    String e = info.getEditingVersion(), r = info.getReviewingVersion();\n    return (e == null || !online.contains(e)) && (r == null || !online.contains(r));\n}","tryCatchPattern":"try {\n    AgentModelValidator.validateAgent(agent);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"must not identify online Versions\")) {\n        // clear stale editing/reviewing pointers that overlap online set\n    }\n}","preventionTips":["Treat onlineVersions as authoritative; clear overlapping edit/review pointers after any publish.","Recompute editing/reviewing slots from the Version lifecycle after online transitions.","Avoid hand-editing both halves of the model independently."],"tags":["ai-agent","validation","version-info","consistency","illegal-argument"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}