{"record":{"id":"1674d552df5b78f6","repo":"alibaba/nacos","slug":"10000-1674d5","errorCode":"10000","errorMessage":"Required parameter 'template' type String is not present","messagePattern":"Required parameter 'template' type String is not present","errorType":"validation","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptDraftUpdateForm.java","lineNumber":46,"sourceCode":" *\n * @author nacos\n */\npublic class PromptDraftUpdateForm extends PromptForm {\n    \n    @Serial\n    private static final long serialVersionUID = 1L;\n    \n    private String template;\n    \n    private String variables;\n    \n    private String commitMsg;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        super.validate();\n        if (StringUtils.isBlank(template)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'template' type String is not present\");\n        }\n    }\n    \n    public String getTemplate() {\n        return template;\n    }\n    \n    public void setTemplate(String template) {\n        this.template = template;\n    }\n    \n    public String getVariables() {\n        return variables;\n    }\n    \n    public void setVariables(String variables) {\n        this.variables = variables;","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptDraftUpdateForm.java#L28-L64","documentation":"Thrown by PromptDraftUpdateForm.validate() when template is blank. Updating an existing draft requires the new template body (unlike create, which allows basedOnVersion as an alternative). super.validate() (promptKey) runs first. Maps to code 10000 (PARAMETER_MISSING), HTTP 400.","triggerScenarios":"Calling PUT to update a prompt draft (PromptAdminController.updateDraft) with promptKey set but template omitted.","commonSituations":"Client sends only variables/commitMsg changes without the full template; UI allows saving metadata-only but the API requires template.","solutions":["Always send the full (possibly modified) template when updating a draft.","Fetch the current draft template first, apply edits, then re-submit the complete template.","Ensure promptKey is also present."],"exampleFix":"// before\ntemplate=\n// after\ntemplate=Revised {{name}}, welcome back","handlingStrategy":"validation","validationCode":"if (template == null || template.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"template required for draft update\");\n}","typeGuard":"static boolean hasTemplate(String t) {\n    return t != null && !t.trim().isEmpty();\n}","tryCatchPattern":"catch (NacosApiException e) {\n    if (e.getErrCode() == 10000 && e.getMessage().contains(\"'template'\")) { /* send full template */ }\n}","preventionTips":["Fetch the current draft template, edit, then re-send the whole template.","Never send a metadata-only update to this endpoint."],"tags":["validation","ai","prompt","parameter","http","api"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}