{"record":{"id":"8694f4feddc74512","repo":"alibaba/nacos","slug":"parameter-missing-8694f4","errorCode":"PARAMETER_MISSING","errorMessage":"Required parameter 'labels' type String is not present","messagePattern":"Required parameter 'labels' type String is not present","errorType":"exception","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptLabelsUpdateForm.java","lineNumber":45,"sourceCode":" * Prompt labels update form.\n *\n * @author nacos\n */\npublic class PromptLabelsUpdateForm extends PromptForm {\n    \n    @Serial\n    private static final long serialVersionUID = 1L;\n    \n    /**\n     * JSON string: {\"stable\":\"0.0.1\"}. The reserved label \"latest\" is managed by server.\n     */\n    private String labels;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        super.validate();\n        if (StringUtils.isBlank(labels)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'labels' type String is not present\");\n        }\n    }\n    \n    public String getLabels() {\n        return labels;\n    }\n    \n    public void setLabels(String labels) {\n        this.labels = labels;\n    }\n}\n","sourceCodeStart":27,"sourceCodeEnd":58,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptLabelsUpdateForm.java#L27-L58","documentation":"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.","triggerScenarios":"Calling the labels-update endpoint (PromptAdminController.updateLabels) with promptKey set but labels omitted or empty.","commonSituations":"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 '{}'.","solutions":["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).","To set labels, send e.g. labels={\"stable\":\"1.0.0\"}.","Do not include 'latest' — it is managed by the server."],"exampleFix":"// before\npromptKey=myPrompt&labels=\n// after\npromptKey=myPrompt&labels={\"stable\":\"1.0.0\"}","handlingStrategy":"validation","validationCode":"if (labels == null || labels.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"labels JSON required\");\n}","typeGuard":"static boolean hasLabels(String json) {\n    return json != null && !json.trim().isEmpty();\n}","tryCatchPattern":"catch (NacosApiException e) {\n    if (e.getErrCode() == 10000 && e.getMessage().contains(\"'labels'\")) { /* send label map JSON */ }\n}","preventionTips":["Send labels as a JSON object string; omit 'latest' (server-managed).","To clear custom labels, verify whether '{}' is accepted downstream before sending blank."],"tags":["validation","ai","prompt","label","parameter","http","api"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}