{"record":{"id":"4f3bdad5bb2435d8","repo":"alibaba/nacos","slug":"resource-conflict-4f3bda","errorCode":"RESOURCE_CONFLICT","errorMessage":"No editing draft to overwrite: {name}","messagePattern":"No editing draft to overwrite: (.+?)","errorType":"exception","errorClass":"NacosApiException","httpStatus":409,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/service/skills/SkillOperationServiceImpl.java","lineNumber":516,"sourceCode":"        AiResourceTraceService.logSuccess(RESOURCE_TYPE_SKILL, name, newVersion,\n            AiResourceTraceService.OP_UPLOAD,\n            VisibilityHelper.resolveCurrentIdentity(), VisibilityHelper.resolveClientIp());\n        return name;\n    }\n    \n    /**\n     * Handle overwrite upload. If an editing draft exists, keep its version for lower or equal\n     * upload versions, or replace it with the uploaded version when that version can legally become\n     * the new draft version.\n     */\n    private String overwriteUploadedSkill(String namespaceId, Skill skill, String uploadVersion,\n        AiResource meta, boolean requireEditingDraft, String commitMsg)\n        throws NacosException {\n        String name = skill.getName();\n        // No meta record = brand-new skill, create directly\n        if (meta == null) {\n            if (requireEditingDraft) {\n                throw new NacosApiException(NacosException.CONFLICT, ErrorCode.RESOURCE_CONFLICT,\n                    \"No editing draft to overwrite: \" + name);\n            }\n            createDraftWithSkill(namespaceId, skill, uploadVersion, null, true, commitMsg);\n            return name;\n        }\n        \n        checkWritableUploadResource(meta);\n        ResourceVersionInfo info = AiResourceManager.requireVersionInfo(meta);\n        ensureNoReviewingVersion(info, \"overwrite upload\");\n        String editing = info.getEditingVersion();\n        if (StringUtils.isNotBlank(editing)) {\n            String targetVersion = resolveOverwriteDraftVersion(namespaceId, name, uploadVersion,\n                editing);\n            if (editing.equals(targetVersion)) {\n                overwriteEditingDraft(namespaceId, skill, meta, editing, commitMsg);\n                return name;\n            }\n            deleteDraftAndCreateUploadedSkill(namespaceId, skill, targetVersion, meta, commitMsg);","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/skills/SkillOperationServiceImpl.java#L498-L534","documentation":"A CONFLICT (HTTP 409, ErrorCode RESOURCE_CONFLICT/20005) from overwriteUploadedSkill: the caller requested an action that requires an existing editing draft (OVERWRITE_DRAFT or DELETE_DRAFT_AND_CREATE, both of which set requireEditingDraft=true) but no meta row exists for the skill at all — i.e. it is a brand-new skill with nothing to overwrite.","triggerScenarios":"Applying an OVERWRITE_DRAFT / DELETE_DRAFT_AND_CREATE uploadAction (or a stale precheck result suggesting one) for a skill name that has no meta record, because it was never created or was concurrently deleted.","commonSituations":"Acting on a stale precheck whose target skill was since deleted; first-time upload mistakenly using an overwrite action; race between a delete and the upload.","solutions":["For a new skill, use CREATE_DRAFT (or a blank uploadAction with overwrite=false).","Re-run precheckUploadSkillFromZip to get a fresh recommended action for the current state.","If the skill was deleted unexpectedly, investigate concurrent delete before recreating."],"exampleFix":"// before — overwrite action on a skill that does not exist yet\nrequest.setUploadAction(SkillUploadPrecheckResult.ACTION_OVERWRITE_DRAFT); // throws 331\n\n// after — create for a brand-new skill\nrequest.setUploadAction(SkillUploadPrecheckResult.ACTION_CREATE_DRAFT);","handlingStrategy":"validation","validationCode":"// Confirm a meta row exists before applying an overwrite-style action.\nboolean exists = resourceManager.findMeta(ns, name, RESOURCE_TYPE_SKILL) != null;\nString action = exists && hasEditingDraft(ns, name)\n    ? SkillUploadPrecheckResult.ACTION_OVERWRITE_DRAFT\n    : SkillUploadPrecheckResult.ACTION_CREATE_DRAFT;","typeGuard":null,"tryCatchPattern":"try {\n    skillOp.uploadSkillFromZip(req); // OVERWRITE_DRAFT on a new skill\n} catch (NacosApiException e) {\n    if (e.getErrCode() == NacosException.CONFLICT\n            && ErrorCode.RESOURCE_CONFLICT.getCode() == e.getDetailErrCode()\n            && e.getErrMsg().contains(\"No editing draft to overwrite\")) {\n        req.setUploadAction(SkillUploadPrecheckResult.ACTION_CREATE_DRAFT);\n        skillOp.uploadSkillFromZip(req); // retry as create\n    } else {\n        throw e;\n    }\n}","preventionTips":["Use CREATE_DRAFT for brand-new skills; reserve overwrite actions for existing drafts.","Re-run precheck before applying an overwrite/delete-create action.","Guard against concurrent deletes before an overwrite upload."],"tags":["upload","conflict","draft","lifecycle","skill"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}