{"record":{"id":"c7a74d3212476e17","repo":"alibaba/nacos","slug":"request-parameter-name-should-not-be-null-or-emp","errorCode":null,"errorMessage":"Request parameter `name` should not be null or empty.","messagePattern":"Request parameter `name` should not be null or empty\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"auth/src/main/java/com/alibaba/nacos/auth/parser/http/AgentSpecNameHttpResourceParser.java","lineNumber":35,"sourceCode":"package com.alibaba.nacos.auth.parser.http;\n\nimport com.alibaba.nacos.common.utils.StringUtils;\nimport jakarta.servlet.http.HttpServletRequest;\n\n/**\n * AgentSpec HTTP resource parser that resolves the target from the client {@code name} parameter.\n *\n * @author xiweng.yy\n */\npublic class AgentSpecNameHttpResourceParser extends AiHttpResourceParser {\n    \n    private static final String AGENT_SPEC_NAME_PARAM = \"name\";\n    \n    @Override\n    protected String getResourceName(HttpServletRequest request) {\n        String agentSpecName = request.getParameter(AGENT_SPEC_NAME_PARAM);\n        if (StringUtils.isBlank(agentSpecName)) {\n            throw new IllegalArgumentException(\n                \"Request parameter `name` should not be null or empty.\");\n        }\n        return agentSpecName;\n    }\n}\n","sourceCodeStart":17,"sourceCodeEnd":41,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/auth/src/main/java/com/alibaba/nacos/auth/parser/http/AgentSpecNameHttpResourceParser.java#L17-L41","documentation":"AgentSpecNameHttpResourceParser resolves the authz target from the HTTP 'name' parameter for AgentSpec operations keyed by name (lookup/delete). A blank name makes resource-scoped authorization impossible, so it throws IllegalArgumentException.","triggerScenarios":"Calling an AgentSpec name-keyed HTTP API (e.g. get/delete by name) without the name query/form parameter.","commonSituations":"Console action with no selection; script deleting by name but the variable was empty; parameter shadowed by content-type handling.","solutions":["Include a non-blank name parameter in the request.","Validate name is selected/present before issuing the request from the UI."],"exampleFix":"// before\ncurl -X DELETE 'http://nacos:8848/v3/admin/ai/agent/spec'  # no name -> 558\n\n// after\ncurl -X DELETE 'http://nacos:8848/v3/admin/ai/agent/spec?name=my-agent'","handlingStrategy":"validation","validationCode":"String name = request.getParameter(\"name\");\nif (StringUtils.isBlank(name)) {\n    return Result.failure(\"name is required\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Require a selected AgentSpec name in the UI before issuing name-keyed actions.","Guard empty variables in scripts before calling the API."],"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"}