alibaba/nacos · error · NacosApiException
10000
10000
Error message
Required parameter 'template' type String is not present
What it means
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.
Source
Thrown at ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptDraftUpdateForm.java:46
*
* @author nacos
*/
public class PromptDraftUpdateForm extends PromptForm {
@Serial
private static final long serialVersionUID = 1L;
private String template;
private String variables;
private String commitMsg;
@Override
public void validate() throws NacosApiException {
super.validate();
if (StringUtils.isBlank(template)) {
throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,
"Required parameter 'template' type String is not present");
}
}
public String getTemplate() {
return template;
}
public void setTemplate(String template) {
this.template = template;
}
public String getVariables() {
return variables;
}
public void setVariables(String variables) {
this.variables = variables;View on GitHub (pinned to 9b989acdf1)
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.
Example fix
// before
template=
// after
template=Revised {{name}}, welcome back Defensive patterns
Strategy: validation
Validate before calling
if (template == null || template.trim().isEmpty()) {
throw new IllegalArgumentException("template required for draft update");
} Type guard
static boolean hasTemplate(String t) {
return t != null && !t.trim().isEmpty();
} Try / catch
catch (NacosApiException e) {
if (e.getErrCode() == 10000 && e.getMessage().contains("'template'")) { /* send full template */ }
} Prevention
- Fetch the current draft template, edit, then re-send the whole template.
- Never send a metadata-only update to this endpoint.
When it happens
Trigger: Calling PUT to update a prompt draft (PromptAdminController.updateDraft) with promptKey set but template omitted.
Common situations: Client sends only variables/commitMsg changes without the full template; UI allows saving metadata-only but the API requires template.
Related errors
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/1674d552df5b78f6.
Report an issue: GitHub.