{"record":{"id":"0af60b6ec7329691","repo":"alibaba/nacos","slug":"parameter-missing-0af60b","errorCode":"PARAMETER_MISSING","errorMessage":"Required parameter 'version' type String is not present","messagePattern":"Required parameter 'version' type String is not present","errorType":"exception","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptOnlineForm.java","lineNumber":42,"sourceCode":"import java.io.Serial;\n\n/**\n * Prompt online/offline form.\n *\n * @author nacos\n */\npublic class PromptOnlineForm extends PromptForm {\n    \n    @Serial\n    private static final long serialVersionUID = 1L;\n    \n    private String version;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        super.validate();\n        if (StringUtils.isBlank(version)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'version' type String is not present\");\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","sourceCodeStart":24,"sourceCodeEnd":55,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptOnlineForm.java#L24-L55","documentation":"PromptOnlineForm.validate() requires a `version` field because toggling a prompt online/offline operates on a specific published version, not the prompt as a whole. `super.validate()` runs first (validating the promptKey base fields), then this check fails fast with PARAMETER_MISSING if version is blank, so the server never attempts to flip state on an unspecified version.","triggerScenarios":"Calling the prompt online or offline API (e.g. PUT /v3/admin/ai/prompts/online) with the `version` field missing, empty, or whitespace-only. Required because the operation is version-scoped.","commonSituations":"Assuming online/offline applies to the latest version automatically and omitting `version`; passing only `promptKey`; frontend form that sends a draft/unpublished version string that resolves to empty; version field name typo in the request body.","solutions":["Add `version` in major.minor.patch form (e.g. `1.0.0`) to the request.","Fetch the list of published versions first to identify the correct version string to toggle.","If your UI means 'toggle the latest version', resolve the latest version server-side first and then send that explicit version."],"exampleFix":"// before\n{\"promptKey\":\"hello\",\"namespaceId\":\"public\"}\n// after\n{\"promptKey\":\"hello\",\"namespaceId\":\"public\",\"version\":\"1.0.0\"}","handlingStrategy":"validation","validationCode":"// Before calling prompt online/offline\nif (version == null || version.isBlank()) {\n    throw new IllegalArgumentException(\"version is required for prompt online/offline\");\n}","typeGuard":"// TypeScript\nconst hasVersion = (v?: string | null): boolean =>\n  v != null && v.trim().length > 0;","tryCatchPattern":"try {\n    form.validate();\n} catch (NacosApiException e) {\n    // PARAMETER_MISSING for version — prompt user to select a version\n}","preventionTips":["Resolve the latest version from the list API before enabling the online/offline button.","Disable the toggle button in the UI until a version is selected.","Make version a required field in the request DTO with a non-null constraint."],"tags":["validation","prompt-api","required-field","version"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}