{"record":{"id":"cf537f71c15bb529","repo":"alibaba/nacos","slug":"20002-cf537f","errorCode":"20002","errorMessage":"Request parameter `search` should be `accurate` or `blur`.","messagePattern":"Request parameter `search` should be `accurate` or `blur`\\.","errorType":"validation","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/form/agentspecs/admin/AgentSpecListForm.java","lineNumber":50,"sourceCode":"    \n    @Serial\n    private static final long serialVersionUID = 1L;\n    \n    private String search;\n    \n    /**\n     * Sort field. Supported values: \"download_count\". Defaults to gmt_modified when null or empty.\n     */\n    private String orderBy;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        fillDefaultNamespaceId();\n        // For list query, agentSpecName is optional\n        if (StringUtils.isNotBlank(search)\n            && !Constants.AgentSpecs.SEARCH_ACCURATE.equalsIgnoreCase(search)\n            && !Constants.AgentSpecs.SEARCH_BLUR.equalsIgnoreCase(search)) {\n            throw new NacosApiException(NacosApiException.INVALID_PARAM,\n                ErrorCode.PARAMETER_VALIDATE_ERROR,\n                \"Request parameter `search` should be `accurate` or `blur`.\");\n        }\n    }\n    \n    public String getSearch() {\n        return search;\n    }\n    \n    public void setSearch(String search) {\n        this.search = search;\n    }\n    \n    public String getOrderBy() {\n        return orderBy;\n    }\n    \n    public void setOrderBy(String orderBy) {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/agentspecs/admin/AgentSpecListForm.java#L32-L68","documentation":"Thrown by EndpointNaturalKey.of(namespaceId, agentName, protocol, Endpoint) when the endpoint argument is null. The natural key is derived from the Endpoint's URI and transport, so a null Endpoint has no identity to key on. The overloaded of(...) that takes uri+transport does not perform this null check.","triggerScenarios":"Calling EndpointNaturalKey.of with a null Endpoint, e.g. building identity for a collection entry that was null, or after a failed lookup that returned null.","commonSituations":"A registry/dedup map built from Endpoints where one source produced null; chaining ofNullable lookups without a guard; misusing the Endpoint-based overload when you only have uri/transport (prefer the other overload).","solutions":["Null-check the Endpoint before calling EndpointNaturalKey.of, or use the (namespaceId, agentName, protocol, uri, transport) overload when you lack an Endpoint object.","Filter null Endpoints out of collections before keying.","Return Optional/skip when a lookup yields null instead of keying it."],"exampleFix":"// before\nEndpointNaturalKey key = EndpointNaturalKey.of(ns, name, proto, endpoint);\n// after\nif (endpoint == null) {\n    continue;\n}\nEndpointNaturalKey key = EndpointNaturalKey.of(ns, name, proto, endpoint);","handlingStrategy":"type-guard","validationCode":"if (endpoint == null) {\n    throw new IllegalArgumentException(\"Endpoint must not be null\");\n}\nEndpointNaturalKey.of(namespaceId, agentName, protocol, endpoint);","typeGuard":"static boolean hasEndpointIdentity(Endpoint e) {\n    return e != null;\n}","tryCatchPattern":"try {\n    EndpointNaturalKey key = EndpointNaturalKey.of(ns, name, proto, endpoint);\n} catch (IllegalArgumentException e) {\n    // skip null endpoint or return 400\n}","preventionTips":["Prefer the uri+transport overload when you lack an Endpoint object.","Filter nulls out of collections before keying."],"tags":["ai-agent","endpoint","natural-key","null-check","illegal-argument"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}