microsoft/autogen · error · ValueError
default_chat_model not found in config.models
Error message
default_chat_model not found in config.models
What it means
GraphRAG LocalSearchTool.from_settings loads the same settings.yaml and requires a chat model registered under the reserved ID 'default_chat_model' in config.models. If missing, ValueError('default_chat_model not found in config.models') is raised before any model or token encoder is created. Local search uses this model for answer synthesis over community/local context.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_local_search.py:209
def from_settings(cls, root_dir: Path, config_filepath: Path | None = None) -> "LocalSearchTool":
"""Create a LocalSearchTool instance from GraphRAG settings file.
Args:
root_dir: Path to the GraphRAG root directory
config_filepath: Path to the GraphRAG settings file (optional)
Returns:
An initialized LocalSearchTool instance
"""
# Load GraphRAG config
config = load_config(root_dir=root_dir, config_filepath=config_filepath)
# Get the language model configurations from the models section
chat_model_config = config.models.get(defs.DEFAULT_CHAT_MODEL_ID)
embedding_model_config = config.models.get(defs.DEFAULT_EMBEDDING_MODEL_ID)
if chat_model_config is None:
raise ValueError("default_chat_model not found in config.models")
if embedding_model_config is None:
raise ValueError("default_embedding_model not found in config.models")
# Initialize token encoder based on the model being used
try:
token_encoder = tiktoken.encoding_for_model(chat_model_config.model)
except KeyError:
# Fallback to cl100k_base if model is not recognized by tiktoken
token_encoder = tiktoken.get_encoding("cl100k_base")
# Create the models using ModelManager
model = ModelManager().get_or_create_chat_model(
name="local_search_model",
model_type=chat_model_config.type,
config=chat_model_config,
)
embedder = ModelManager().get_or_create_embedding_model(View on GitHub (pinned to 027ecf0a37)
Solutions
- Add a models.default_chat_model entry (type, model, api_key) to settings.yaml.
- Add models.default_embedding_model as well, since local search raises on it next if absent.
- Re-generate settings.yaml with the version of the graphrag tooling matching this autogen-ext release.
- Verify root_dir points at the workspace containing the settings file you edited.
Example fix
# settings.yaml — before
models:
default_embedding_model:
type: openai_embedding
model: text-embedding-3-small
# settings.yaml — after
models:
default_chat_model:
type: openai_chat
model: gpt-4o
api_key: ${GRAPHRAG_API_KEY}
default_embedding_model:
type: openai_embedding
model: text-embedding-3-small
api_key: ${GRAPHRAG_API_KEY} Defensive patterns
Strategy: validation
Validate before calling
cfg = load_config(root_dir=root_dir, config_filepath=config_filepath)
missing = [k for k in ("default_chat_model",) if k not in cfg.models]
if missing:
raise ValueError(f"settings.yaml missing models entries: {missing}") Try / catch
try:
tool = await LocalSearchTool.from_settings(root_dir=root_dir)
except ValueError as e:
raise ConfigError(f"GraphRAG config incomplete: {e}") from e Prevention
- Local search needs BOTH default_chat_model and default_embedding_model — validate both up front.
- Generate settings.yaml with the graphrag CLI version matching your autogen-ext release.
- Log the resolved root_dir/config path before loading so wrong-directory mistakes are obvious.
When it happens
Trigger: Calling LocalSearchTool.from_settings(root_dir=..., config_filepath=...) with a settings.yaml whose models dict has no 'default_chat_model' key. Note local search additionally requires 'default_embedding_model'; the chat-model check fires first.
Common situations: Same family of issues as global search: pre-migration settings.yaml, renamed model keys, wrong root_dir, or settings generated by an incompatible graphrag CLI version. Frequently hit when only the embedding model was configured because earlier experiments used only vector lookups.
Related errors
- default_chat_model not found in config.models
- default_embedding_model not found in config.models
- Failed to fetch settings
- Failed to update settings
- modelName is a required property for LMStudioConfig and cann
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/c675e7636b158f15.
Report an issue: GitHub.