{"record":{"id":"ed7b69a0b56fccf4","repo":"alibaba/nacos","slug":"10000-ed7b69","errorCode":"10000","errorMessage":"Required parameter 'name' type String is not present","messagePattern":"Required parameter 'name' type String is not present","errorType":"validation","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/form/a2a/admin/AgentForm.java","lineNumber":52,"sourceCode":" **/\npublic class AgentForm implements NacosForm {\n    \n    @Serial\n    private static final long serialVersionUID = -73912927386186928L;\n    \n    private String namespaceId;\n    \n    private String agentName;\n    \n    private String version;\n    \n    private String registrationType;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        fillDefaultNamespaceId();\n        if (StringUtils.isEmpty(agentName)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'name' type String is not present\");\n        }\n    }\n    \n    protected void fillDefaultNamespaceId() {\n        if (StringUtils.isEmpty(namespaceId)) {\n            namespaceId = A2A_DEFAULT_NAMESPACE;\n        }\n    }\n    \n    public String getNamespaceId() {\n        return namespaceId;\n    }\n    \n    public void setNamespaceId(String namespaceId) {\n        this.namespaceId = namespaceId;\n    }\n    ","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/a2a/admin/AgentForm.java#L34-L70","documentation":"Thrown by AgentValidationUtils.validateLabel when a version label is null, longer than 64 chars, or fails [A-Za-z0-9][A-Za-z0-9._-]{0,63}. A label must start alphanumeric then contain alphanumerics, dots, underscores, or dashes (1-64 chars). Note 'latest' itself passes this check but is rejected separately by validateNonLatestLabel.","triggerScenarios":"Creating/moving a version label (RadModelValidator.validateLabelReference line 209, AgentVersionCatalogBuilder line 136, AgentPersistenceService.validateLabelTargets line 907) with an empty label, a leading dot/dash/underscore, a space, or >64 chars.","commonSituations":"Using a git-style ref with a leading slash or slash inside; labels derived from branch names containing '/'; uppercase vs lowercase confusion (uppercase is allowed but teams often standardize); over-long descriptive labels.","solutions":["Use labels like '1.0.0', 'stable', 'rc.1' (start alphanumeric, only [A-Za-z0-9._-] afterwards, <=64).","Strip leading non-alphanumeric characters and slashes before assigning a label.","Generate labels from a controlled vocabulary, not free-form user text."],"exampleFix":"// before\nreference.setLabel(\"feature/x\");\n// after\nreference.setLabel(\"feature-x\");","handlingStrategy":"validation","validationCode":"if (label == null || label.length() > 64\n        || !label.matches(\"^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$\")) {\n    throw new IllegalArgumentException(\"Invalid label\");\n}","typeGuard":"static boolean isValidLabel(String s) {\n    return s != null && s.length() <= 64\n        && s.matches(\"^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$\");\n}","tryCatchPattern":"try {\n    AgentValidationUtils.validateLabel(label);\n} catch (IllegalArgumentException e) {\n    // return 400, field 'label'\n}","preventionTips":["Strip slashes and leading non-alphanumeric chars from derived labels.","Generate labels from a controlled vocabulary."],"tags":["ai-agent","validation","label","illegal-argument"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}