{"record":{"id":"040c32eb53d30ac9","repo":"alibaba/nacos","slug":"editingversion-and-reviewingversion-must-identify","errorCode":null,"errorMessage":"editingVersion and reviewingVersion must identify different Versions","messagePattern":"editingVersion and reviewingVersion must identify different Versions","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/com/alibaba/nacos/api/ai/utils/AgentModelValidator.java","lineNumber":417,"sourceCode":"        Map<String, String> labels = versionInfo.getLabels();\n        requireNonNull(labels, \"versionInfo.labels\");\n        for (Map.Entry<String, String> entry : labels.entrySet()) {\n            AgentValidationUtils.validateLabel(entry.getKey());\n            AgentValidationUtils.validateVersion(entry.getValue());\n        }\n    }\n    \n    private static void validateVersionInfoCatalogConsistency(AgentVersionInfo versionInfo,\n        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        }","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/api/src/main/java/com/alibaba/nacos/api/ai/utils/AgentModelValidator.java#L399-L435","documentation":"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.","triggerScenarios":"Setting both editingVersion and reviewingVersion to the same Version string in one payload; copying one field into the other during a refactor.","commonSituations":"Promoting a Version and forgetting to clear the old slot; test fixtures that set both fields to the same constant for brevity.","solutions":["Ensure editingVersion and reviewingVersion reference different Version strings, or leave one null.","When a Version moves from editing to reviewing, null out editingVersion rather than duplicating.","Review any code path that assigns both fields from the same source value."],"exampleFix":"// before\nversionInfo.setEditingVersion(\"1.0.0\"); versionInfo.setReviewingVersion(\"1.0.0\");\n// after\nversionInfo.setEditingVersion(null); versionInfo.setReviewingVersion(\"1.0.0\");","handlingStrategy":"validation","validationCode":"static void checkEditingVsReviewing(AgentVersionInfo info) {\n    String e = info.getEditingVersion(), r = info.getReviewingVersion();\n    if (e != null && e.equals(r)) {\n        throw new IllegalArgumentException(\n            \"editingVersion and reviewingVersion must identify different Versions\");\n    }\n}","typeGuard":"static boolean editingAndReviewingDiffer(AgentVersionInfo info) {\n    String e = info.getEditingVersion(), r = info.getReviewingVersion();\n    return e == null || r == null || !e.equals(r);\n}","tryCatchPattern":"try {\n    AgentModelValidator.validateAgent(agent);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"editingVersion and reviewingVersion must identify different\")) {\n        agent.getVersionInfo().setEditingVersion(null); // resolve conflict\n    }\n}","preventionTips":["When a Version moves to reviewing, null out editingVersion rather than duplicating.","Never assign both slots from the same source value.","Unit-test promotion paths against this invariant."],"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"}