{"record":{"id":"a0d9248e5a1e84ca","repo":"alibaba/nacos","slug":"10000-a0d924","errorCode":"10000","errorMessage":"Request parameter `agentSpecName` should not be blank.","messagePattern":"Request parameter `agentSpecName` should not be blank\\.","errorType":"validation","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/form/agentspecs/admin/AgentSpecLabelsUpdateForm.java","lineNumber":45,"sourceCode":" * AgentSpec labels update form.\n *\n * @author nacos\n */\npublic class AgentSpecLabelsUpdateForm extends AgentSpecForm {\n    \n    @Serial\n    private static final long serialVersionUID = 1L;\n    \n    /**\n     * JSON string: {\"stable\":\"v2\"}. The reserved label \"latest\" is managed by server.\n     */\n    private String labels;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        fillDefaultNamespaceId();\n        if (StringUtils.isBlank(getAgentSpecName())) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"Request parameter `agentSpecName` should not be blank.\");\n        }\n        if (StringUtils.isBlank(labels)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"Request parameter `labels` should not be blank.\");\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":62,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/agentspecs/admin/AgentSpecLabelsUpdateForm.java#L27-L62","documentation":"Thrown by EndpointCanonicalizer.canonicalize when endpoint.getPriority() is non-null and negative. A null priority defaults to 0; an explicit non-negative value is accepted; only a strictly negative integer is rejected. Priority influences Endpoint selection ordering.","triggerScenarios":"Submitting an Endpoint with priority set to a negative number (e.g. -1) through any path that canonicalizes the Endpoint before persistence/push.","commonSituations":"Using -1 as a sentinel for 'default' (the code treats null, not -1, as default); sign errors in priority computation; configs that use negative numbers for 'lowest'.","solutions":["Use null (or omit the field) to get the default priority of 0, or set a non-negative integer.","Replace any -1 'unset' sentinel with null at the boundary.","Clamp computed priorities to >=0 before submission."],"exampleFix":"// before\nendpoint.setPriority(-1);\n// after\nendpoint.setPriority(null); // defaults to 0","handlingStrategy":"validation","validationCode":"Integer p = endpoint.getPriority();\nif (p != null && p < 0) {\n    throw new IllegalArgumentException(\"Endpoint priority must not be negative\");\n}","typeGuard":"static boolean isValidPriority(Integer p) {\n    return p == null || p >= 0;\n}","tryCatchPattern":"try {\n    Endpoint canon = EndpointCanonicalizer.canonicalize(endpoint);\n} catch (IllegalArgumentException e) {\n    // return 400, priority out of range\n}","preventionTips":["Use null (not -1) to mean 'default priority'.","Clamp computed priorities to >=0."],"tags":["ai-agent","endpoint","priority","validation","illegal-argument"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}