{"record":{"id":"479f05ea33f8b249","repo":"microsoft/semantic-kernel","slug":"no-vector-or-keywords-provided-for-vector-search","errorCode":null,"errorMessage":"No vector or keywords provided for vector search.","messagePattern":"No vector or keywords provided for vector search\\.","errorType":"exception","errorClass":"VectorStoreOperationException","httpStatus":null,"severity":"warning","filePath":"python/semantic_kernel/connectors/azure_ai_search.py","lineNumber":593,"sourceCode":"                elif values is not None:\n                    generated_vector = await self._generate_vector_from_values(values or \"*\", options)\n                    vector_field = self.definition.try_get_vector_field(options.vector_property_name)\n                    if generated_vector is not None:\n                        search_args[\"vector_queries\"] = [\n                            VectorizedQuery(\n                                vector=generated_vector,  # type: ignore\n                                fields=vector_field.storage_name or vector_field.name if vector_field else None,\n                            )\n                        ]\n                    else:\n                        search_args[\"vector_queries\"] = [\n                            VectorizableTextQuery(\n                                text=values,\n                                fields=vector_field.storage_name or vector_field.name if vector_field else None,\n                            )\n                        ]\n                else:\n                    raise VectorStoreOperationException(\"No vector or keywords provided for vector search.\")\n            case SearchType.KEYWORD_HYBRID:\n                if values is None:\n                    raise VectorStoreOperationException(\"No vector and/or keywords provided for search.\")\n                vector_field = self.definition.try_get_vector_field(options.vector_property_name)\n                search_args[\"search_fields\"] = (\n                    [options.additional_property_name]\n                    if options.additional_property_name is not None\n                    else [\n                        field.name\n                        for field in self.definition.fields\n                        if field.field_type == FieldTypes.DATA and field.is_full_text_indexed\n                    ]\n                )\n                if not search_args[\"search_fields\"]:\n                    raise VectorStoreOperationException(\"No searchable fields found for hybrid search.\")\n                search_args[\"search_text\"] = values\n\n                vector = await self._generate_vector_from_values(values, options) if vector is None else vector","sourceCodeStart":575,"sourceCodeEnd":611,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/azure_ai_search.py#L575-L611","documentation":"Raised by _inner_search for SearchType.VECTOR when both the 'vector' argument and the 'values' argument are None. A pure vector search requires either a precomputed vector (Sequence[float|int]) or text 'values' that can be embedded/vectorized. With neither, there is no query to run, so a VectorStoreOperationException is thrown before contacting the service.","triggerScenarios":"Calling search with search_type=SearchType.VECTOR (the collection's default for vector-only) while passing neither vector nor values — e.g. search(vector=None, values=None). Also when a caller's embedding pipeline returned None and that None was forwarded as values.","commonSituations":"Conditionally building a query that ends up with no input; an upstream embedding service returning None on failure and that propagating into the search call; defaulting values to None when the user submitted an empty string.","solutions":["Always provide either a precomputed vector or a non-None values (text) for vector search.","If using text values, ensure an embedding_generator is configured on the collection so values can be vectorized.","Guard the call: skip or error early upstream if both vector and values resolve to None."],"exampleFix":"// before\nresults = await collection.search(vector=None, values=query_text)  # query_text is None\n\n// after\nif query_text:\n    results = await collection.search(values=query_text)\nelse:\n    raise ValueError(\"query text required for vector search\")","handlingStrategy":"validation","validationCode":"def require_vector_search_input(vector=None, values=None):\n    if vector is None and values is None:\n        raise ValueError(\"VECTOR search requires a vector or values\")\n\nrequire_vector_search_input(vector=vec, values=q)","typeGuard":null,"tryCatchPattern":"from semantic_kernel.exceptions import VectorStoreOperationException\ntry:\n    res = await collection.search(vector=vec, values=q)\nexcept VectorStoreOperationException as e:\n    if \"No vector or keywords provided\" in str(e):\n        q = q or default_query\n        res = await collection.search(values=q)\n    raise","preventionTips":["Always pass non-None values (text) or a precomputed vector for vector search.","Ensure an embedding_generator is configured if relying on text-to-vector.","Guard call sites where query input may be conditionally None."],"tags":["api-misuse","azure-ai-search","vector-search"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}