alibaba/nacos · error · NacosApiException

RESOURCE_NOT_FOUND

RESOURCE_NOT_FOUND

Error message

{type} version not found: {name}@{version}

What it means

Thrown inside doPublish when the version row to publish cannot be found by persistService.find. Maps to RESOURCE_NOT_FOUND (NOT_FOUND). The publish target version must exist before its status and pipeline can be validated.

Source

Thrown at ai/src/main/java/com/alibaba/nacos/ai/service/resource/AiResourceManager.java:962

    public AiResourceVersion doPublish(String namespaceId, String name, String type, String version,
        boolean updateLatestLabel) throws NacosException {
        return doPublish(namespaceId, name, type, version, true,
            VisibilityHelper.resolveCurrentIdentity(), VisibilityHelper.resolveClientIp());
    }
    
    private AiResourceVersion doPublish(String namespaceId, String name, String type,
        String version, boolean checkVisibility, String operator, String clientIp)
        throws NacosException {
        AiResource meta = requireMeta(namespaceId, name, type);
        if (checkVisibility) {
            VisibilityHelper.checkWritableResource(meta);
        }
        ResourceVersionInfo info = requireVersionInfo(meta);
        
        AiResourceVersion v =
            aiResourceVersionPersistService.find(namespaceId, name, type, version);
        if (v == null) {
            throw new NacosApiException(NacosException.NOT_FOUND, ErrorCode.RESOURCE_NOT_FOUND,
                type + " version not found: " + name + "@" + version);
        }
        if (!AiResourceConstants.VERSION_STATUS_REVIEWING.equalsIgnoreCase(v.getStatus())
            && !AiResourceConstants.VERSION_STATUS_REVIEWED.equalsIgnoreCase(v.getStatus())
            && !AiResourceConstants.VERSION_STATUS_ONLINE.equalsIgnoreCase(v.getStatus())) {
            throw new NacosApiException(NacosException.INVALID_PARAM,
                ErrorCode.PARAMETER_VALIDATE_ERROR,
                "Only reviewing version can be published: " + version);
        }
        
        PublishPipelineInfo pipelineInfo = parsePublishPipelineInfo(v.getPublishPipelineInfo());
        if (pipelineInfo != null && StringUtils.isNotBlank(pipelineInfo.getExecutionId())) {
            PipelineExecution execution =
                pipelineExecutionRepository.findById(pipelineInfo.getExecutionId());
            if (execution == null) {
                throw new NacosApiException(NacosException.INVALID_PARAM,
                    ErrorCode.PARAMETER_VALIDATE_ERROR,
                    "Pipeline execution not found, cannot publish: " + version);

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Confirm the version exists via a list/get before invoking publish.
  2. Correct the version identifier to the actual reviewing/reviewed version.
  3. Check that namespace, name, and type all match the resource that owns the version.
Defensive patterns

Strategy: validation

Validate before calling

AiResourceVersion v = aiResourceVersionPersistService.find(ns, name, type, version);
if (v == null) { return notFound(version); }

Try / catch

try {
    return manager.doPublish(ns, name, type, version, ...);
} catch (NacosApiException e) {
    if (e.getErrCode() == NacosException.NOT_FOUND) { /* re-list versions */ }
    else { throw e; }
}

Prevention

When it happens

Trigger: Publish API called with a version identifier that does not exist for the resource — wrong name, deleted version, or namespace/type mismatch.

Common situations: Publishing a version name from a different resource; version hard-deleted between submit and publish; client-side stale reference.

Related errors


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