microsoft/autogen · error · ValueError
vector_fields must be provided for vector search
Error message
vector_fields must be provided for vector search
What it means
The config model's second interdependent rule: query_type='vector' requires a non-empty vector_fields list, because the client must know which vector field of the index receives the query embedding. It backs up the factory-level checks (errors 926/927) and also applies to directly constructed or deserialized configs.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/tools/azure/_config.py:176
return "full"
return v
@field_validator("top")
def validate_top(cls, v: Optional[int]) -> Optional[int]:
"""Ensure top is a positive integer if provided."""
if v is not None and v <= 0:
raise ValueError("top must be a positive integer")
return v
@model_validator(mode="after")
def validate_interdependent_fields(self) -> "AzureAISearchConfig":
"""Validate interdependent fields after all fields have been parsed."""
if self.query_type == "semantic" and not self.semantic_config_name:
raise ValueError("semantic_config_name must be provided when query_type is 'semantic'")
if self.query_type == "vector" and not self.vector_fields:
raise ValueError("vector_fields must be provided for vector search")
if (
self.embedding_provider
and self.embedding_provider.lower() == "azure_openai"
and self.embedding_model
and not self.openai_endpoint
):
raise ValueError("openai_endpoint must be provided for azure_openai embedding provider")
return self
View on GitHub (pinned to 027ecf0a37)
Solutions
- Set vector_fields=['<vector-field-name>'] matching the index's vector field (Collection(Edm.Single)).
- Or change query_type to 'simple'/'full' if you only need text search.
- Validate saved configs in CI by constructing AzureAISearchConfig from the file contents.
Example fix
# before AzureAISearchConfig(name='s', endpoint=ep, index_name='idx', credential=cred, query_type='vector') # after AzureAISearchConfig(name='s', endpoint=ep, index_name='idx', credential=cred, query_type='vector', vector_fields=['content_vector'])
Defensive patterns
Strategy: validation
Validate before calling
def vector_fields_rule_ok(cfg_dict: dict) -> bool:
if cfg_dict.get('query_type') == 'vector':
vf = cfg_dict.get('vector_fields')
return isinstance(vf, (list, tuple)) and len(vf) > 0
return True Type guard
def vector_fields_present(query_type: str, vector_fields) -> bool:
return query_type != 'vector' or (isinstance(vector_fields, (list, tuple)) and len(vector_fields) > 0) Prevention
- Whenever query_type is 'vector' or 'hybrid', supply vector_fields matching the index's vector field.
- Pin the vector field name in the same config as the ingestion pipeline that writes embeddings.
- Validate serialized configs in CI by round-tripping them through AzureAISearchConfig.
When it happens
Trigger: AzureAISearchConfig(query_type='vector') (or deserialized config with that query_type) where vector_fields is None, missing, or []; note also that hybrid requires vector_fields via the factory path even though this specific validator keys on 'vector'.
Common situations: Hand-editing serialized component configs to enable vector search without adding vector_fields; configs from an older schema version; the index's vector field renamed so the list was emptied.
Related errors
- Invalid configuration: {str(e)}
- vector_fields must contain at least one field name for vecto
- vector_fields must contain at least one field name for hybri
- endpoint must be a valid URL starting with http:// or https:
- top must be a positive integer
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/306a1bf750eb55e1.
Report an issue: GitHub.