{"record":{"id":"5c58bed82ac2f94a","repo":"alibaba/nacos","slug":"parameter-validate-error","errorCode":"PARAMETER_VALIDATE_ERROR","errorMessage":"Request parameter 'search' should be 'accurate' or 'blur'.","messagePattern":"Request parameter 'search' should be 'accurate' or 'blur'\\.","errorType":"exception","errorClass":"NacosApiException","httpStatus":400,"severity":"warning","filePath":"ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptListForm.java","lineNumber":73,"sourceCode":"    \n    /**\n     * Page number (1-based).\n     */\n    private int pageNo = 1;\n    \n    /**\n     * Page size.\n     */\n    private int pageSize = 10;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        fillDefaultNamespaceId();\n        \n        if (StringUtils.isNotBlank(search)\n            && !Constants.Prompt.SEARCH_ACCURATE.equalsIgnoreCase(search)\n            && !Constants.Prompt.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        if (pageNo < 1) {\n            pageNo = 1;\n        }\n        if (pageSize < 1) {\n            pageSize = 10;\n        }\n        if (pageSize > MAX_PAGE_SIZE) {\n            pageSize = MAX_PAGE_SIZE;\n        }\n    }\n    \n    private void fillDefaultNamespaceId() {\n        if (StringUtils.isEmpty(namespaceId)) {\n            namespaceId = Constants.Prompt.PROMPT_DEFAULT_NAMESPACE;","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptListForm.java#L55-L91","documentation":"PromptListForm.validate() guards the prompt list query's optional `search` parameter. When `search` is non-blank it must case-insensitively equal \"accurate\" (exact match) or \"blur\" (substring match) — the only two modes the underlying query supports. Any other value means the caller has asked for an undefined search behavior, so the server rejects it with PARAMETER_VALIDATE_ERROR before executing the query.","triggerScenarios":"Calling the prompt list API (e.g. GET /v3/admin/ai/prompts/list or the SDK equivalent) with search set to a value other than accurate/blur, such as `search=fuzzy`, `search=partial`, `search=contains`, or `search=exact`. Leaving `search` null/blank does NOT trigger it — the parameter is optional.","commonSituations":"Developers used to other APIs that use \"fuzzy\" as the fuzzy-search keyword; UI dropdowns that emit \"exact\" instead of \"accurate\"; copy-pasting a query param from a different Nacos resource type whose naming differs; typos like \"accuate\".","solutions":["Set `search=accurate` for exact match, or `search=blur` for substring/fuzzy match (case-insensitive).","Omit the `search` parameter entirely if you don't need to filter — the default behavior applies.","If you intended exact matching but used \"exact\", switch to \"accurate\"; if you intended fuzzy matching but used \"fuzzy\", switch to \"blur\"."],"exampleFix":"// before\nGET /v3/admin/ai/prompts/list?search=fuzzy&promptKey=hello\n// after\nGET /v3/admin/ai/prompts/list?search=blur&promptKey=hello","handlingStrategy":"validation","validationCode":"// Java client, before calling the prompt list API\nString search = form.getSearch();\nif (search != null && !search.isBlank()\n    && !\"accurate\".equalsIgnoreCase(search)\n    && !\"blur\".equalsIgnoreCase(search)) {\n    throw new IllegalArgumentException(\"search must be 'accurate', 'blur', or null\");\n}","typeGuard":"// TypeScript (frontend) before sending\nconst isValidSearch = (s: string | null | undefined): boolean =>\n  s == null || s === \"\" ||\n  \"accurate\".equalsIgnoreCase?.(s) ||\n  [\"accurate\",\"blur\"].includes(s.toLowerCase());","tryCatchPattern":"try {\n    PromptListForm form = new PromptListForm();\n    form.setSearch(search);\n    form.validate(); // throws NacosApiException\n} catch (NacosApiException e) {\n    if (e.getDetail() == ErrorCode.PARAMETER_VALIDATE_ERROR) {\n        // surface to UI: invalid search mode\n    }\n}","preventionTips":["Whitelist the search dropdown to exactly ['accurate','blur'] in the UI.","Omit search rather than send 'fuzzy' — null is accepted.","Add a client-side unit test asserting only accurate/blur pass validation."],"tags":["validation","prompt-api","query","parameter-validation"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}