infiniflow/ragflow · error · LookupError

Embedding model(%s) not found

Error message

Embedding model(%s) not found

What it means

LookupError raised in get_models when LLMBundle construction for the embedding model returns falsy even though the first dataset has an embd_id. In practice LLMBundle raises on missing configuration, so this guard fires mainly when the bundle factory returns None — i.e. the embedding model reference exists on the dataset but cannot be resolved to a usable model instance for the owner tenant.

Source

Thrown at api/db/services/dialog_service.py:366

            answer = await chat_mdl.async_chat(system_prompt, msg, dialog.llm_setting, images=image_files)
        user_content = msg[-1].get("content", "[content not available]")
        logging.debug("User: {}|Assistant: {}".format(user_content, answer))
        yield {"answer": answer, "reference": {}, "audio_binary": tts(tts_mdl, answer), "prompt": "", "created_at": time.time()}


def get_models(dialog, trace_context=None, langfuse_session_id=None):
    embd_mdl, chat_mdl, rerank_mdl, tts_mdl = None, None, None, None
    kbs = KnowledgebaseService.get_by_ids(dialog.kb_ids)
    err = validate_dataset_embedding_models(kbs)
    if err:
        raise Exception(err)

    if kbs and kbs[0].embd_id:
        embd_owner_tenant_id = kbs[0].tenant_id
        embd_model_config = resolve_model_config(embd_owner_tenant_id, LLMType.EMBEDDING, kbs[0].embd_id)
        embd_mdl = LLMBundle(embd_owner_tenant_id, embd_model_config, trace_context=trace_context, langfuse_session_id=langfuse_session_id)
        if not embd_mdl:
            raise LookupError("Embedding model(%s) not found" % kbs[0].embd_id)

    if dialog.llm_id:
        if dialog.tenant_llm_id:
            try:
                chat_model_config = get_model_config_by_id(dialog.tenant_id, LLMType.CHAT, dialog.tenant_llm_id)
            except LookupError:
                chat_model_config = resolve_model_config(dialog.tenant_id, LLMType.CHAT, dialog.llm_id)
        else:
            chat_model_config = resolve_model_config(dialog.tenant_id, LLMType.CHAT, dialog.llm_id)
    else:
        chat_model_config = get_tenant_default_model_by_type(dialog.tenant_id, LLMType.CHAT)

    chat_mdl = LLMBundle(dialog.tenant_id, chat_model_config, trace_context=trace_context, langfuse_session_id=langfuse_session_id)

    if dialog.rerank_id:
        if dialog.tenant_rerank_id:
            try:
                rerank_model_config = get_model_config_by_id(dialog.tenant_id, LLMType.RERANK, dialog.tenant_rerank_id)

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Open the model provider settings and re-add/re-enable the embedding model named by kb.embd_id with a valid API key.
  2. Verify the tenant_model row / tenant_embd_id binding still resolves for the dataset's owner tenant.
  3. If the model is permanently gone, re-embed the dataset with a currently configured embedding model.
Defensive patterns

Strategy: try-catch

Validate before calling

cfg = resolve_model_config(kb.tenant_id, LLMType.EMBEDDING, kb.embd_id) if kb.embd_id else None
if cfg is None:
    raise ValueError(f"embedding model {kb.embd_id!r} not resolvable for tenant {kb.tenant_id}")

Try / catch

try:
    embd_mdl, chat_mdl, *_ = get_models(dialog)
except LookupError as e:
    # embedding/provider config broken: send user to model provider settings
    report_model_config_error(str(e), dialog.kb_ids)

Prevention

When it happens

Trigger: Chat/ask against a dialog whose first kb has embd_id set, but resolve_model_config/LLMBundle yield nothing — e.g. model provider row deleted, tenant_model binding removed, or API key for the provider missing so the bundle cannot be constructed.

Common situations: Embedding provider uninstalled or disabled after datasets were built; tenant model configuration reset; switching from a composite model id whose instance no longer exists.

Related errors


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/ff37eb6a46936d03. Report an issue: GitHub.