{"record":{"id":"75616cb705720022","repo":"alibaba/nacos","slug":"required-parameter-agentspeccard-name-is-not-pre","errorCode":null,"errorMessage":"Required parameter `agentSpecCard.name` is not present.","messagePattern":"Required parameter `agentSpecCard\\.name` is not present\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"auth/src/main/java/com/alibaba/nacos/auth/parser/http/AgentSpecCardHttpResourceParser.java","lineNumber":49,"sourceCode":"    \n    private static final String AGENT_SPEC_CARD_PARAM = \"agentSpecCard\";\n    \n    @Override\n    protected String getResourceName(HttpServletRequest request) {\n        String agentSpecCard = request.getParameter(AGENT_SPEC_CARD_PARAM);\n        if (StringUtils.isBlank(agentSpecCard)) {\n            throw new IllegalArgumentException(\n                \"Request parameter `agentSpecCard` should not be null or empty.\");\n        }\n        AgentSpec agentSpec;\n        try {\n            agentSpec = JacksonUtils.toObj(agentSpecCard, AgentSpec.class);\n        } catch (NacosDeserializationException e) {\n            throw new IllegalArgumentException(\n                \"Request parameter `agentSpecCard` is invalid and cannot be parsed.\", e);\n        }\n        if (agentSpec == null || StringUtils.isBlank(agentSpec.getName())) {\n            throw new IllegalArgumentException(\n                \"Required parameter `agentSpecCard.name` is not present.\");\n        }\n        return agentSpec.getName();\n    }\n}\n","sourceCodeStart":31,"sourceCodeEnd":55,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/auth/src/main/java/com/alibaba/nacos/auth/parser/http/AgentSpecCardHttpResourceParser.java#L31-L55","documentation":"Third guard in AgentSpecCardHttpResourceParser: the JSON parsed successfully but the resulting AgentSpec has a null/blank name. Authorization requires a concrete resource name, so the parser refuses the request.","triggerScenarios":"Submitting an agentSpecCard JSON that omits the name field or sets it to empty.","commonSituations":"Template payload missing the name property; building AgentSpec from optional fields where name was never populated.","solutions":["Ensure the agentSpecCard JSON contains a non-blank 'name' field.","Validate the AgentSpec object's name client-side before serializing."],"exampleFix":"// before\nagentSpecCard='{\"description\":\"demo\"}'  // no name -> 557\n\n// after\nagentSpecCard='{\"name\":\"my-agent\",\"description\":\"demo\"}'","handlingStrategy":"validation","validationCode":"AgentSpec spec = JacksonUtils.toObj(agentSpecCard, AgentSpec.class);\nif (spec == null || StringUtils.isBlank(spec.getName())) {\n    throw new IllegalArgumentException(\"agentSpecCard.name is required\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always populate the name field on AgentSpec payloads.","Validate the model client-side before serializing to JSON."],"tags":["ai","agentspec","auth","http","validation","parameter"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}