{"record":{"id":"c0851bdd82ed889d","repo":"alibaba/nacos","slug":"parameter-validate-error-c0851b","errorCode":"PARAMETER_VALIDATE_ERROR","errorMessage":"Parameter 'version' must be in format 'major.minor.patch' (e.g., '1.0.0')","messagePattern":"Parameter 'version' must be in format 'major\\.minor\\.patch' \\(e\\.g\\., '1\\.0\\.0'\\)","errorType":"exception","errorClass":"NacosApiException","httpStatus":400,"severity":"warning","filePath":"ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptPublishForm.java","lineNumber":79,"sourceCode":"    \n    /**\n     * Variable definitions with default values (JSON array string, optional).\n     *\n     * <p>Example: [{\"name\":\"question\",\"defaultValue\":\"Hello\",\"description\":\"User question\"}]</p>\n     */\n    private String variables;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        super.validate();\n        \n        if (StringUtils.isEmpty(version)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'version' type String is not present\");\n        }\n        \n        if (!PromptVersionUtils.isValidVersion(version)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM,\n                ErrorCode.PARAMETER_VALIDATE_ERROR,\n                \"Parameter 'version' must be in format 'major.minor.patch' (e.g., '1.0.0')\");\n        }\n    }\n    \n    public String getVersion() {\n        return version;\n    }\n    \n    public void setVersion(String version) {\n        this.version = version;\n    }\n    \n    public String getTemplate() {\n        return template;\n    }\n    \n    public void setTemplate(String template) {","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptPublishForm.java#L61-L97","documentation":"PromptPublishForm.validate() enforces that the `version` field match the semantic version regex `^\\d+\\.\\d+\\.\\d+$` via PromptVersionUtils.isValidVersion. Versions are stored and compared as dotted triples, so a non-conforming string would break version ordering and storage paths; the server rejects it with PARAMETER_VALIDATE_ERROR after the presence check (error 42) passes.","triggerScenarios":"Calling prompt publish with a version like `1.0`, `v1.0.0`, `1.0.0-beta`, `1.0.0.0`, `latest`, or `1.2`. Only plain `MAJOR.MINOR.PATCH` with non-negative integers is accepted.","commonSituations":"Using CalVer or git tags as version; adding a `v` prefix (common in git tags); including pre-release/build suffixes (semver) which this regex rejects; using `1.0` thinking it implies `1.0.0`; truncating from a UI that shows two-part versions.","solutions":["Format the version as exactly three dot-separated non-negative integers, e.g. `2.1.3`.","Strip any leading `v` or `V` before sending.","Drop pre-release/build suffixes (`-beta`, `+build`) — the API does not support them.","If you have a two-part version like `1.0`, expand to `1.0.0`."],"exampleFix":"// before\n{\"version\":\"v1.2.0-beta\"}\n// after\n{\"version\":\"1.2.0\"}","handlingStrategy":"validation","validationCode":"// Reuse the server's own validator client-side\nboolean ok = version != null && version.matches(\"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+$\");\nif (!ok) {\n    throw new IllegalArgumentException(\"version must be major.minor.patch, e.g. 1.0.0\");\n}","typeGuard":"// TypeScript\nconst isSemverTriplet = (v: string): boolean =>\n  /^\\d+\\.\\d+\\.\\d+$/.test(v);","tryCatchPattern":"try {\n    form.validate();\n} catch (NacosApiException e) {\n    // PARAMETER_VALIDATE_ERROR — fix version format and retry\n}","preventionTips":["Strip a leading 'v' from version strings before sending.","Reject pre-release/build suffixes client-side; the API does not support them.","Use a version-input component that enforces three numeric segments."],"tags":["validation","prompt-api","version","semantic-versioning","parameter-validation"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}