{"record":{"id":"66eb97490a8daaa7","repo":"alibaba/nacos","slug":"parameter-validate-error-66eb97","errorCode":"PARAMETER_VALIDATE_ERROR","errorMessage":"Only reviewing version can be published: {version}","messagePattern":"Only reviewing version can be published: (.+?)","errorType":"validation","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/service/resource/AiResourceManager.java","lineNumber":968,"sourceCode":"    private AiResourceVersion doPublish(String namespaceId, String name, String type,\n        String version, boolean checkVisibility, String operator, String clientIp)\n        throws NacosException {\n        AiResource meta = requireMeta(namespaceId, name, type);\n        if (checkVisibility) {\n            VisibilityHelper.checkWritableResource(meta);\n        }\n        ResourceVersionInfo info = requireVersionInfo(meta);\n        \n        AiResourceVersion v =\n            aiResourceVersionPersistService.find(namespaceId, name, type, version);\n        if (v == null) {\n            throw new NacosApiException(NacosException.NOT_FOUND, ErrorCode.RESOURCE_NOT_FOUND,\n                type + \" version not found: \" + name + \"@\" + version);\n        }\n        if (!AiResourceConstants.VERSION_STATUS_REVIEWING.equalsIgnoreCase(v.getStatus())\n            && !AiResourceConstants.VERSION_STATUS_REVIEWED.equalsIgnoreCase(v.getStatus())\n            && !AiResourceConstants.VERSION_STATUS_ONLINE.equalsIgnoreCase(v.getStatus())) {\n            throw new NacosApiException(NacosException.INVALID_PARAM,\n                ErrorCode.PARAMETER_VALIDATE_ERROR,\n                \"Only reviewing version can be published: \" + version);\n        }\n        \n        PublishPipelineInfo pipelineInfo = parsePublishPipelineInfo(v.getPublishPipelineInfo());\n        if (pipelineInfo != null && StringUtils.isNotBlank(pipelineInfo.getExecutionId())) {\n            PipelineExecution execution =\n                pipelineExecutionRepository.findById(pipelineInfo.getExecutionId());\n            if (execution == null) {\n                throw new NacosApiException(NacosException.INVALID_PARAM,\n                    ErrorCode.PARAMETER_VALIDATE_ERROR,\n                    \"Pipeline execution not found, cannot publish: \" + version);\n            }\n            if (execution.getStatus() != PipelineExecutionStatus.APPROVED) {\n                throw new NacosApiException(NacosException.INVALID_PARAM,\n                    ErrorCode.PARAMETER_VALIDATE_ERROR,\n                    \"Pipeline not approved, cannot publish: \" + version);\n            }","sourceCodeStart":950,"sourceCodeEnd":986,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/resource/AiResourceManager.java#L950-L986","documentation":"Thrown inside doPublish when the version exists but its status is none of reviewing/reviewed/online. Only versions that have entered (or completed) review may be published; a 'draft' or 'offline' version cannot be published directly. Maps to PARAMETER_VALIDATE_ERROR (INVALID_PARAM). Note the message text ('Only reviewing version can be published') is narrower than the code, which also permits reviewed and online as no-op/idempotent paths.","triggerScenarios":"Publishing a draft version that was never submitted to review; publishing an offline version directly (must go through a new draft/submit/review cycle); publishing a version still in draft.","commonSituations":"Operator tries to publish straight from draft, skipping review; the version was offline and someone attempts a direct re-publish.","solutions":["Submit the version to review (moveToReviewing) and wait for review approval before publishing.","If the version is offline, create a new draft from it and run the full submit→review→publish flow.","Use force-publish (doForcePublish) only if policy explicitly permits bypassing review."],"exampleFix":"// before: publishing a draft version\nmanager.doPublish(ns, name, type, \"v1.0\", ...); // throws, v1.0 is draft\n// after: submit to review, then publish once reviewed\nmanager.moveToReviewing(ns, name, type, \"v1.0\", meta, info);\n// ... after review approval ...\nmanager.doPublish(ns, name, type, \"v1.0\", ...);","handlingStrategy":"validation","validationCode":"Set<String> publishable = Set.of(\"reviewing\", \"reviewed\", \"online\");\nif (!publishable.contains(v.getStatus().toLowerCase())) {\n    // submit to review first\n}","typeGuard":null,"tryCatchPattern":"try {\n    manager.doPublish(ns, name, type, version, ...);\n} catch (NacosApiException e) {\n    if (e.getErrCode() == NacosException.INVALID_PARAM\n        && e.getMessage().contains(\"can be published\")) {\n        // run moveToReviewing then wait for approval, then publish\n    } else { throw e; }\n}","preventionTips":["Publish only versions that have completed review.","For offline versions, start a fresh draft/submit/review cycle rather than direct publish."],"tags":["ai-registry","version-lifecycle","publish","validation"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}