alibaba/nacos · error · NacosApiException

RESOURCE_CONFLICT

RESOURCE_CONFLICT

Error message

No editing draft to overwrite: {name}

What it means

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.

Source

Thrown at ai/src/main/java/com/alibaba/nacos/ai/service/skills/SkillOperationServiceImpl.java:516

        AiResourceTraceService.logSuccess(RESOURCE_TYPE_SKILL, name, newVersion,
            AiResourceTraceService.OP_UPLOAD,
            VisibilityHelper.resolveCurrentIdentity(), VisibilityHelper.resolveClientIp());
        return name;
    }
    
    /**
     * Handle overwrite upload. If an editing draft exists, keep its version for lower or equal
     * upload versions, or replace it with the uploaded version when that version can legally become
     * the new draft version.
     */
    private String overwriteUploadedSkill(String namespaceId, Skill skill, String uploadVersion,
        AiResource meta, boolean requireEditingDraft, String commitMsg)
        throws NacosException {
        String name = skill.getName();
        // No meta record = brand-new skill, create directly
        if (meta == null) {
            if (requireEditingDraft) {
                throw new NacosApiException(NacosException.CONFLICT, ErrorCode.RESOURCE_CONFLICT,
                    "No editing draft to overwrite: " + name);
            }
            createDraftWithSkill(namespaceId, skill, uploadVersion, null, true, commitMsg);
            return name;
        }
        
        checkWritableUploadResource(meta);
        ResourceVersionInfo info = AiResourceManager.requireVersionInfo(meta);
        ensureNoReviewingVersion(info, "overwrite upload");
        String editing = info.getEditingVersion();
        if (StringUtils.isNotBlank(editing)) {
            String targetVersion = resolveOverwriteDraftVersion(namespaceId, name, uploadVersion,
                editing);
            if (editing.equals(targetVersion)) {
                overwriteEditingDraft(namespaceId, skill, meta, editing, commitMsg);
                return name;
            }
            deleteDraftAndCreateUploadedSkill(namespaceId, skill, targetVersion, meta, commitMsg);

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. For a new skill, use CREATE_DRAFT (or a blank uploadAction with overwrite=false).
  2. Re-run precheckUploadSkillFromZip to get a fresh recommended action for the current state.
  3. If the skill was deleted unexpectedly, investigate concurrent delete before recreating.

Example fix

// before — overwrite action on a skill that does not exist yet
request.setUploadAction(SkillUploadPrecheckResult.ACTION_OVERWRITE_DRAFT); // throws 331

// after — create for a brand-new skill
request.setUploadAction(SkillUploadPrecheckResult.ACTION_CREATE_DRAFT);
Defensive patterns

Strategy: validation

Validate before calling

// Confirm a meta row exists before applying an overwrite-style action.
boolean exists = resourceManager.findMeta(ns, name, RESOURCE_TYPE_SKILL) != null;
String action = exists && hasEditingDraft(ns, name)
    ? SkillUploadPrecheckResult.ACTION_OVERWRITE_DRAFT
    : SkillUploadPrecheckResult.ACTION_CREATE_DRAFT;

Try / catch

try {
    skillOp.uploadSkillFromZip(req); // OVERWRITE_DRAFT on a new skill
} catch (NacosApiException e) {
    if (e.getErrCode() == NacosException.CONFLICT
            && ErrorCode.RESOURCE_CONFLICT.getCode() == e.getDetailErrCode()
            && e.getErrMsg().contains("No editing draft to overwrite")) {
        req.setUploadAction(SkillUploadPrecheckResult.ACTION_CREATE_DRAFT);
        skillOp.uploadSkillFromZip(req); // retry as create
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/4f3bdad5bb2435d8. Report an issue: GitHub.