{"record":{"id":"ae134eaf28413803","repo":"alibaba/nacos","slug":"10000-ae134e","errorCode":"10000","errorMessage":"AgentSpec name is required","messagePattern":"AgentSpec name is required","errorType":"validation","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/form/agentspecs/client/AgentSpecQueryForm.java","lineNumber":51,"sourceCode":"    private String name;\n    \n    private String version;\n    \n    private String label;\n    \n    private String md5;\n    \n    /**\n     * Validate and normalize query parameters.\n     *\n     * @throws NacosApiException if required parameters are missing\n     */\n    public void validate() throws NacosApiException {\n        if (StringUtils.isBlank(namespaceId)) {\n            namespaceId = Constants.AgentSpecs.AGENTSPEC_DEFAULT_NAMESPACE;\n        }\n        if (StringUtils.isBlank(name)) {\n            throw new NacosApiException(NacosApiException.INVALID_PARAM,\n                ErrorCode.PARAMETER_MISSING,\n                \"AgentSpec name is required\");\n        }\n    }\n    \n    public String getNamespaceId() {\n        return namespaceId;\n    }\n    \n    public void setNamespaceId(String namespaceId) {\n        this.namespaceId = namespaceId;\n    }\n    \n    public String getName() {\n        return name;\n    }\n    \n    public void setName(String name) {","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/agentspecs/client/AgentSpecQueryForm.java#L33-L69","documentation":"Thrown by AgentSpecQueryForm.validate() when the `name` field is blank. This is the client-runtime GET endpoint used by agents/SDKs to fetch an online AgentSpec by version/label. Unlike the admin forms it does NOT extend AgentSpecForm; namespaceId defaults to 'public' but name is mandatory. Maps to code 10000 (PARAMETER_MISSING), HTTP 400.","triggerScenarios":"Calling GET /v3/admin/ai/agentspecs (the client OPEN_API, anonymous-allowed) without the `name` query parameter. Supports optional version/label/md5 for conditional get.","commonSituations":"An agent SDK or RAD client fetches an agentspec before the name is configured; misconfigured environment variable yields an empty name; the caller passes the name under a different key (e.g. agentSpecName) instead of `name`.","solutions":["Add the `name` query parameter to the GET request.","If using a config-driven name, verify the env/config value is non-empty before the call.","Note this endpoint expects `name`, not `agentSpecName` — match the exact field."],"exampleFix":"// before\ncurl 'http://host/v3/admin/ai/agentspecs?version=latest'\n// after\ncurl 'http://host/v3/admin/ai/agentspecs?name=mySpec&version=latest'","handlingStrategy":"validation","validationCode":"if (name == null || name.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"AgentSpec name is required\");\n}","typeGuard":"static boolean hasName(String n) {\n    return n != null && !n.trim().isEmpty();\n}","tryCatchPattern":"catch (NacosApiException e) {\n    if (e.getErrCode() == 10000 && e.getMessage().contains(\"AgentSpec name\")) { /* supply name */ }\n}","preventionTips":["Remember the client endpoint uses `name`, not agentSpecName.","Resolve the agentspec name from config before the runtime fetch."],"tags":["validation","ai","agentspec","client","parameter","http","api"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}