{"record":{"id":"73124ddcb31faf8a","repo":"alibaba/nacos","slug":"resource-conflict-73124d","errorCode":"RESOURCE_CONFLICT","errorMessage":"There is already a working version (editing/reviewing), cannot {action}","messagePattern":"There is already a working version \\(editing/reviewing\\), cannot (.+?)","errorType":"exception","errorClass":"NacosApiException","httpStatus":409,"severity":"warning","filePath":"ai/src/main/java/com/alibaba/nacos/ai/service/resource/AiResourceManager.java","lineNumber":1357,"sourceCode":"            return latest;\n        }\n        List<String> existingVersions = listExistingVersions(namespaceId, name, type);\n        String maxSemver = VersionUtils.maxSemver(existingVersions);\n        return StringUtils.isNotBlank(maxSemver) ? maxSemver\n            : VersionUtils.maxVNumberVersion(existingVersions);\n    }\n    \n    /**\n     * Ensure no editing or reviewing version exists; throw CONFLICT otherwise.\n     *\n     * @param info   the parsed version info\n     * @param action action description for error message (e.g. \"upload\", \"create draft\")\n     */\n    public static void ensureNoWorkingVersion(ResourceVersionInfo info, String action)\n        throws NacosException {\n        if (StringUtils.isNotBlank(info.getEditingVersion())\n            || StringUtils.isNotBlank(info.getReviewingVersion())) {\n            throw new NacosApiException(NacosException.CONFLICT, ErrorCode.RESOURCE_CONFLICT,\n                \"There is already a working version (editing/reviewing), cannot \" + action);\n        }\n    }\n    \n    private static void ensureNoEditingVersion(ResourceVersionInfo info, String action)\n        throws NacosException {\n        if (StringUtils.isNotBlank(info.getEditingVersion())) {\n            throw new NacosApiException(NacosException.CONFLICT, ErrorCode.RESOURCE_CONFLICT,\n                \"There is already an editing version, cannot \" + action);\n        }\n    }\n    \n    private static void ensureNoOtherWorkingVersion(ResourceVersionInfo info, String version,\n        String action)\n        throws NacosException {\n        if ((StringUtils.isNotBlank(info.getEditingVersion())\n            && !StringUtils.equals(info.getEditingVersion(), version))\n            || (StringUtils.isNotBlank(info.getReviewingVersion())","sourceCodeStart":1339,"sourceCodeEnd":1375,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/resource/AiResourceManager.java#L1339-L1375","documentation":"Thrown by ensureNoWorkingVersion when either editingVersion or reviewingVersion is non-blank. A resource may have at most one in-flight working version at a time; attempting to start another draft/submit/upload is rejected. Maps to RESOURCE_CONFLICT (409).","triggerScenarios":"Create-draft or upload API called on a resource that already has a draft (editingVersion) or a version under review (reviewingVersion). The action name is interpolated into the message (e.g. 'upload', 'create draft').","commonSituations":"Two operators editing the same resource concurrently; a previous draft was abandoned without being submitted or discarded; UI allows 'new draft' while a review is pending.","solutions":["Submit or discard the existing editing/reviewing version before starting a new one.","Re-fetch version info to show the user the in-flight version and let them resolve it first.","If the working version is stale/abandoned, transition it to a terminal state or remove it before retrying."],"exampleFix":"// before: creating a draft while one already exists\nmanager.createDraft(ns, name, type, null); // throws via ensureNoWorkingVersion\n// after: resolve the existing draft first\n// (submit it, or discard it) then create the new draft","handlingStrategy":"validation","validationCode":"AiResourceManager.ensureNoWorkingVersion(info, action); // call the same guard first\n// or inline:\nif (StringUtils.isNotBlank(info.getEditingVersion())\n    || StringUtils.isNotBlank(info.getReviewingVersion())) {\n    return conflict(action);\n}","typeGuard":null,"tryCatchPattern":"try {\n    manager.createDraft(ns, name, type, basedOnVersion);\n} catch (NacosApiException e) {\n    if (e.getErrCode() == NacosException.CONFLICT\n        && e.getMessage().contains(\"working version\")) {\n        // prompt user to submit/discard the existing draft or reviewing version\n    } else { throw e; }\n}","preventionTips":["Resolve (submit or discard) the existing draft/reviewing version before starting a new one.","Reflect in-flight working versions in the UI so users do not start duplicates."],"tags":["ai-registry","version-lifecycle","conflict","concurrency","draft"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}