microsoft/autogen · error · ValueError

default_embedding_model not found in config.models

Error message

default_embedding_model not found in config.models

What it means

GraphRAG LocalSearchTool.from_settings requires both 'default_chat_model' and 'default_embedding_model' in config.models. If the embedding model entry is missing, ValueError('default_embedding_model not found in config.models') is raised. Local search embeds the query and compares it against embedded entities/relationships, so an embedding model is mandatory, unlike global search.

Source

Thrown at python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_local_search.py:211

        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(
            name="local_search_embedder",
            model_type=embedding_model_config.type,

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Add models.default_embedding_model (e.g. type: openai_embedding, model: text-embedding-3-small, api_key) to settings.yaml.
  2. Ensure the model name is one the embedding model factory supports for the declared type.
  3. If you only need map-reduce style global search, use GlobalSearchTool instead, which does not require the embedding entry.
  4. Regenerate settings.yaml with a matching graphrag version if the schema is old.

Example fix

# settings.yaml — before
models:
  default_chat_model:
    type: openai_chat
    model: gpt-4o

# settings.yaml — after
models:
  default_chat_model:
    type: openai_chat
    model: gpt-4o
  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)
required = {"default_chat_model", "default_embedding_model"}
missing = required - set(cfg.models or {})
if missing:
    raise ValueError(f"settings.yaml missing models entries: {sorted(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

When it happens

Trigger: Calling LocalSearchTool.from_settings where settings.yaml has models.default_chat_model but no models.default_embedding_model key. Raised right after the chat-model check passes.

Common situations: Reusing a global-search-only settings file for local search; settings produced by a graphrag CLI that named the embedding entry differently; deleting the embedding entry to save cost and forgetting local search depends on it.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/d47d2a70ae754602. Report an issue: GitHub.