{"record":{"id":"a7c81be8a4fae41d","repo":"alibaba/nacos","slug":"20002-a7c81b","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/mcp/admin/McpListForm.java","lineNumber":46,"sourceCode":" *\n * @author xiweng.yy\n */\npublic class McpListForm extends McpForm {\n    \n    /**\n     * blur or accurate.\n     */\n    private String search;\n    \n    @Serial\n    private static final long serialVersionUID = 9017621414114266178L;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        fillDefaultValue();\n        if (!Constants.MCP_LIST_SEARCH_ACCURATE.equalsIgnoreCase(search)\n            && !Constants.MCP_LIST_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    @Override\n    protected void fillDefaultValue() {\n        super.fillDefaultValue();\n        if (StringUtils.isEmpty(search)) {\n            search = Constants.MCP_LIST_SEARCH_ACCURATE;\n        }\n    }\n    \n    public String getSearch() {\n        return search;\n    }\n    \n    public void setSearch(String search) {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/mcp/admin/McpListForm.java#L28-L64","documentation":"Thrown by McpListForm.validate() when `search` is neither 'accurate' nor 'blur'. Note fillDefaultValue() sets search to 'accurate' when empty, so this error only fires when search is explicitly set to an invalid non-empty value. Comparison is case-insensitive. Maps to code 20002 (PARAMETER_VALIDATE_ERROR), HTTP 400.","triggerScenarios":"Calling GET /v3/admin/ai/mcp/list with search=fuzzy, search=contains, search=1, or any value other than accurate/blur.","commonSituations":"Client passes a custom search-mode vocabulary; a numeric flag instead of the string enum; legacy caller from a version that defaulted differently.","solutions":["Set search to accurate or blur (any case), or omit it entirely to get the default (accurate).","Audit the caller's search-mode mapping and align it to the two allowed values."],"exampleFix":"// before (fails)\nsearch=fuzzy\n// after\nsearch=blur","handlingStrategy":"validation","validationCode":"if (search != null && !\"accurate\".equalsIgnoreCase(search) && !\"blur\".equalsIgnoreCase(search)) {\n    throw new IllegalArgumentException(\"search must be accurate or blur\");\n}","typeGuard":"static boolean isValidSearch(String s) {\n    return s == null || \"accurate\".equalsIgnoreCase(s) || \"blur\".equalsIgnoreCase(s);\n}","tryCatchPattern":"catch (NacosApiException e) {\n    if (e.getErrCode() == 20002 && e.getMessage().contains(\"search\")) { /* use accurate/blur */ }\n}","preventionTips":["Omit search to get the default (accurate).","Restrict the UI to the two allowed values."],"tags":["validation","ai","mcp","parameter","http","api"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}