{"record":{"id":"1c808dc21e742966","repo":"alibaba/nacos","slug":"parameter-missing-1c808d","errorCode":"PARAMETER_MISSING","errorMessage":"Required parameter `query.text` not present","messagePattern":"Required parameter `query\\.text` not present","errorType":"exception","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai-registry-adaptor/src/main/java/com/alibaba/nacos/airegistry/service/ard/ArdSearchServiceImpl.java","lineNumber":334,"sourceCode":"    }\n    \n    private String property(String key, String defaultValue) {\n        String value = System.getProperty(key);\n        if (StringUtils.isNotBlank(value)) {\n            return value;\n        }\n        try {\n            return EnvUtil.getProperty(key, defaultValue);\n        } catch (Exception ignored) {\n            return defaultValue;\n        }\n    }\n    \n    private SearchContext validateAndBuildContext(ArdSearchRequest request)\n        throws NacosApiException {\n        if (request == null || request.getQuery() == null\n            || StringUtils.isBlank(request.getQuery().getText())) {\n            throw new NacosApiException(NacosException.INVALID_PARAM,\n                ErrorCode.PARAMETER_MISSING, \"Required parameter `query.text` not present\");\n        }\n        String federation = StringUtils.isBlank(request.getFederation())\n            ? ArdProtocolConstants.FEDERATION_AUTO : request.getFederation().trim();\n        if (!Arrays.asList(ArdProtocolConstants.FEDERATION_AUTO,\n            ArdProtocolConstants.FEDERATION_REFERRALS,\n            ArdProtocolConstants.FEDERATION_NONE).contains(federation)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM,\n                ErrorCode.PARAMETER_VALIDATE_ERROR,\n                \"Unsupported ARD federation mode: \" + federation);\n        }\n        ArdSearchQuery query = request.getQuery();\n        Map<String, List<String>> filter = normalizeFilter(query);\n        validateFilterKeys(filter.keySet());\n        SearchContext context = new SearchContext();\n        context.namespaceId = StringUtils.isBlank(request.getNamespaceId())\n            ? com.alibaba.nacos.api.common.Constants.DEFAULT_NAMESPACE_ID\n            : request.getNamespaceId();","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai-registry-adaptor/src/main/java/com/alibaba/nacos/airegistry/service/ard/ArdSearchServiceImpl.java#L316-L352","documentation":"Thrown by ArdSearchServiceImpl.validateAndBuildContext() when an ARD search request omits query.text. The validator rejects a null request, a null query, or a blank query.text with PARAMETER_MISSING (HTTP 400). query.text is the single mandatory field for a search call; without it the search cannot run.","triggerScenarios":"POSTing an ArdSearchRequest whose query field is null, whose query.text is null/empty/whitespace, or sending a request body missing the query.text JSON path entirely. Any of these three null-checks triggers the same error.","commonSituations":"Client serializes only filters but forgets the free-text term; a JSON deserialization default leaves query.text null; an explore-style request is mistakenly routed to the search endpoint; a caller trims text to empty before sending.","solutions":["Ensure request.getQuery().getText() is a non-blank string before invoking search.","Validate the JSON payload includes \"query\": {\"text\": \"...\"} with a non-empty value.","If you only want to list/filter without text, use the list/explore endpoint instead of search.","Add a client-side precondition that throws early with a clearer message."],"exampleFix":"// before\nArdSearchRequest req = new ArdSearchRequest();\nreq.setQuery(new ArdSearchQuery()); // text omitted\nservice.search(req);\n\n// after\nArdSearchRequest req = new ArdSearchRequest();\nArdSearchQuery q = new ArdSearchQuery();\nq.setText(\"mcp weather\");\nreq.setQuery(q);\nservice.search(req);","handlingStrategy":"validation","validationCode":"public void validateSearchRequest(ArdSearchRequest request) {\n    if (request == null || request.getQuery() == null\n        || request.getQuery().getText() == null\n        || request.getQuery().getText().trim().isEmpty()) {\n        throw new IllegalArgumentException(\"query.text is required and must be non-blank\");\n    }\n}","typeGuard":"boolean hasSearchText(ArdSearchRequest r) {\n    return r != null && r.getQuery() != null\n        && r.getQuery().getText() != null\n        && !r.getQuery().getText().trim().isEmpty();\n}","tryCatchPattern":null,"preventionTips":["Always populate query.text with a non-blank search term before calling search.","Use the list/explore endpoint when you do not have free text.","Unit-test the request builder to assert query.text is never null/blank."],"tags":["ard","ai-registry","search","parameter-missing","validation"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}