{"record":{"id":"7dfdb98394f57792","repo":"alibaba/nacos","slug":"labels-must-not-identify-editing-or-reviewing-vers","errorCode":null,"errorMessage":"Labels must not identify editing or reviewing Versions","messagePattern":"Labels must not identify editing or reviewing Versions","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/com/alibaba/nacos/api/ai/utils/AgentModelValidator.java","lineNumber":432,"sourceCode":"        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\");\n        }\n        for (AgentVersionCatalogEntry entry : onlineVersions) {\n            for (String label : entry.getLabels()) {\n                if (!entry.getVersion().equals(versionInfo.getLabels().get(label))) {\n                    throw new IllegalArgumentException(\n                        \"Version catalog label does not match versionInfo: \" + label);","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/api/src/main/java/com/alibaba/nacos/api/ai/utils/AgentModelValidator.java#L414-L450","documentation":"Thrown by validateVersionInfoCatalogConsistency when any entry in versionInfo.labels has a value equal to editingVersion or reviewingVersion. Labels are meant to point at online (referenceable) Versions; pointing a label at an in-flight editing/reviewing Version would expose unstable references to consumers.","triggerScenarios":"Setting a label such as labels[\"stable\"] = versionInfo.editingVersion while that Version is still being edited; bulk-assigning all labels to the newest Version regardless of its lifecycle state.","commonSituations":"A promotion script that repoints every label to the just-uploaded Version before it is online; alias labels (latest, stable, canary) pointing at a Version mid-review.","solutions":["Ensure every label value references an online Version, not the editing or reviewing Version.","Defer label repointing until after the target Version is published (appears in onlineVersions).","When promoting, clear or keep labels on the previous online Version until the new one is live."],"exampleFix":"// before\nversionInfo.getLabels().put(\"stable\", versionInfo.getEditingVersion());\n// after\nversionInfo.getLabels().put(\"stable\", someOnlineVersion);","handlingStrategy":"validation","validationCode":"static void checkLabelsNotEditReview(AgentVersionInfo info) {\n    String e = info.getEditingVersion(), r = info.getReviewingVersion();\n    for (var v : info.getLabels().values()) {\n        if (v.equals(e) || v.equals(r)) {\n            throw new IllegalArgumentException(\n                \"Labels must not identify editing or reviewing Versions\");\n        }\n    }\n}","typeGuard":"static boolean labelsAvoidEditReview(AgentVersionInfo info) {\n    String e = info.getEditingVersion(), r = info.getReviewingVersion();\n    return info.getLabels().values().stream()\n        .noneMatch(v -> v.equals(e) || v.equals(r));\n}","tryCatchPattern":"try {\n    AgentModelValidator.validateAgent(agent);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Labels must not identify\")) {\n        // repoint offending labels to an online Version\n    }\n}","preventionTips":["Only point labels at online Versions.","Defer label repointing until the target Version is published.","Run a pre-flight check that label values are all in the online set."],"tags":["ai-agent","validation","version-info","labels","consistency","illegal-argument"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}