alibaba/nacos · error · NacosApiException

PARAMETER_MISSING

PARAMETER_MISSING

Error message

Required parameter 'labels' type String is not present

What it means

Thrown by PromptLabelsUpdateForm.validate() when labels is blank. `labels` is a JSON string (e.g. {"stable":"0.0.1"}) representing the full label map to set on a prompt version; the reserved label 'latest' is server-managed. super.validate() (promptKey) runs first. Maps to ErrorCode.PARAMETER_MISSING (code 10000), HTTP 400.

Source

Thrown at ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptLabelsUpdateForm.java:45

 * Prompt labels update form.
 *
 * @author nacos
 */
public class PromptLabelsUpdateForm extends PromptForm {
    
    @Serial
    private static final long serialVersionUID = 1L;
    
    /**
     * JSON string: {"stable":"0.0.1"}. The reserved label "latest" is managed by server.
     */
    private String labels;
    
    @Override
    public void validate() throws NacosApiException {
        super.validate();
        if (StringUtils.isBlank(labels)) {
            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,
                "Required parameter 'labels' type String is not present");
        }
    }
    
    public String getLabels() {
        return labels;
    }
    
    public void setLabels(String labels) {
        this.labels = labels;
    }
}

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Send labels as a non-blank JSON object string, e.g. {} to represent 'no custom labels' if the service accepts an empty map (verify downstream).
  2. To set labels, send e.g. labels={"stable":"1.0.0"}.
  3. Do not include 'latest' — it is managed by the server.

Example fix

// before
promptKey=myPrompt&labels=
// after
promptKey=myPrompt&labels={"stable":"1.0.0"}
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

static boolean hasLabels(String json) {
    return json != null && !json.trim().isEmpty();
}

Try / catch

catch (NacosApiException e) {
    if (e.getErrCode() == 10000 && e.getMessage().contains("'labels'")) { /* send label map JSON */ }
}

Prevention

When it happens

Trigger: Calling the labels-update endpoint (PromptAdminController.updateLabels) with promptKey set but labels omitted or empty.

Common situations: Client intends to clear all labels by sending empty, but the validator rejects blank; UI saves with no label map; JSON serialization yields an empty string instead of '{}'.

Related errors


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