{"record":{"id":"0304d6fe18f9d3ee","repo":"alibaba/nacos","slug":"10000-0304d6","errorCode":"10000","errorMessage":"Required parameter 'promptKey' type String is not present","messagePattern":"Required parameter 'promptKey' type String is not present","errorType":"validation","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptForm.java","lineNumber":46,"sourceCode":"/**\n * Prompt form base class.\n *\n * @author nacos\n */\npublic class PromptForm implements NacosForm {\n    \n    @Serial\n    private static final long serialVersionUID = 1L;\n    \n    private String namespaceId;\n    \n    private String promptKey;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        fillDefaultNamespaceId();\n        if (StringUtils.isEmpty(promptKey)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'promptKey' type String is not present\");\n        }\n    }\n    \n    protected void fillDefaultNamespaceId() {\n        namespaceId = NamespaceUtil.processNamespaceParameter(namespaceId);\n    }\n    \n    public String getNamespaceId() {\n        return namespaceId;\n    }\n    \n    public void setNamespaceId(String namespaceId) {\n        this.namespaceId = namespaceId;\n    }\n    \n    public String getPromptKey() {\n        return promptKey;","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptForm.java#L28-L64","documentation":"Thrown by PromptForm.validate() (the base class for all prompt admin forms) when promptKey is empty. Because nearly every prompt admin endpoint extends PromptForm, this is the most common prompt error. namespaceId is defaulted via NamespaceUtil before the check. Maps to code 10000 (PARAMETER_MISSING), HTTP 400.","triggerScenarios":"Calling any /v3/admin/ai/prompt... endpoint (delete, draft create/update, labels, description, bind/unbind label) without the promptKey parameter.","commonSituations":"Client uses 'name' or 'promptName' instead of the required `promptKey`; deep-link missing the key; batch tooling drops the key on one record.","solutions":["Provide the promptKey parameter (the prompt's unique key, not display name).","Confirm the exact field name is promptKey across all prompt admin calls.","Default namespaceId is handled server-side, so only promptKey is mandatory."],"exampleFix":"// before\ncurl -X DELETE 'http://host/v3/admin/ai/prompt'\n// after\ncurl -X DELETE 'http://host/v3/admin/ai/prompt' -d 'promptKey=myPromptKey'","handlingStrategy":"validation","validationCode":"if (promptKey == null || promptKey.isEmpty()) {\n    throw new IllegalArgumentException(\"promptKey required\");\n}","typeGuard":"static boolean hasPromptKey(String k) {\n    return k != null && !k.isEmpty();\n}","tryCatchPattern":"catch (NacosApiException e) {\n    if (e.getErrCode() == 10000 && e.getMessage().contains(\"promptKey\")) { /* supply promptKey */ }\n}","preventionTips":["Use promptKey (not name/promptName) on every prompt admin call.","Centralize promptKey resolution in one client helper."],"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"}