alibaba/nacos · error · NacosApiException

10000

10000

Error message

Required parameter 'promptKey' type String is not present

What it means

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.

Source

Thrown at ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptForm.java:46

/**
 * Prompt form base class.
 *
 * @author nacos
 */
public class PromptForm implements NacosForm {
    
    @Serial
    private static final long serialVersionUID = 1L;
    
    private String namespaceId;
    
    private String promptKey;
    
    @Override
    public void validate() throws NacosApiException {
        fillDefaultNamespaceId();
        if (StringUtils.isEmpty(promptKey)) {
            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,
                "Required parameter 'promptKey' type String is not present");
        }
    }
    
    protected void fillDefaultNamespaceId() {
        namespaceId = NamespaceUtil.processNamespaceParameter(namespaceId);
    }
    
    public String getNamespaceId() {
        return namespaceId;
    }
    
    public void setNamespaceId(String namespaceId) {
        this.namespaceId = namespaceId;
    }
    
    public String getPromptKey() {
        return promptKey;

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Provide the promptKey parameter (the prompt's unique key, not display name).
  2. Confirm the exact field name is promptKey across all prompt admin calls.
  3. Default namespaceId is handled server-side, so only promptKey is mandatory.

Example fix

// before
curl -X DELETE 'http://host/v3/admin/ai/prompt'
// after
curl -X DELETE 'http://host/v3/admin/ai/prompt' -d 'promptKey=myPromptKey'
Defensive patterns

Strategy: validation

Validate before calling

if (promptKey == null || promptKey.isEmpty()) {
    throw new IllegalArgumentException("promptKey required");
}

Type guard

static boolean hasPromptKey(String k) {
    return k != null && !k.isEmpty();
}

Try / catch

catch (NacosApiException e) {
    if (e.getErrCode() == 10000 && e.getMessage().contains("promptKey")) { /* supply promptKey */ }
}

Prevention

When it happens

Trigger: Calling any /v3/admin/ai/prompt... endpoint (delete, draft create/update, labels, description, bind/unbind label) without the promptKey parameter.

Common situations: Client uses 'name' or 'promptName' instead of the required `promptKey`; deep-link missing the key; batch tooling drops the key on one record.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/0304d6fe18f9d3ee. Report an issue: GitHub.