infiniflow/ragflow · error · Exception
Cannot search across datasets where some have embedding…
Error message
Cannot search across datasets where some have embedding models and others do not.
What it means
Raised (as a generic Exception) from get_models in dialog_service when validate_dataset_embedding_models returns an error: the dialog references multiple datasets (kb_ids) where some have an embedding model configured and others have none. Mixed embedding state cannot be searched together, so model resolution aborts before building the embedding LLMBundle.
Solutions
- Set an embedding model on the un-embedded dataset(s) — it must match the others (see error 448).
- Remove the un-embedded dataset from the dialog's kb_ids.
- Re-create the empty dataset selecting the same embedding model as the dialog's other datasets, then swap it in.
Example fix
# before dialog.kb_ids = [kb_with_embd.id, kb_without_embd.id] # after: give every dataset the same embedding model kb_without_embd.embd_id = kb_with_embd.embd_id kb_without_embd.save()
Defensive patterns
Strategy: validation
Validate before calling
from api.db.services.knowledgebase_service import KnowledgebaseService, validate_dataset_embedding_models
kbs = KnowledgebaseService.get_by_ids(dialog['kb_ids'])
err = validate_dataset_embedding_models(kbs)
if err:
# fix datasets before opening the chat session
raise ValueError(err) Try / catch
try:
models = get_models(dialog)
except Exception as e:
if 'embedding models' in str(e):
show_dataset_config_error(dialog.kb_ids) # guide user to dataset settings
else:
raise Prevention
- Require an embedding model at dataset creation; disallow empty embd_id.
- When editing a dialog's datasets, re-run validate_dataset_embedding_models on every change.
When it happens
Trigger: Chat/ask request (or any flow calling get_models) against a dialog whose kb_ids includes at least one dataset with embd_id set and at least one with empty embd_id.
Common situations: Attaching a newly created dataset that never had an embedding model selected to an existing dialog with embedded datasets; a dataset whose embedding model was cleared; migrating dialogs that accumulated datasets over time.
Related errors
- Datasets use different embedding models
- dataset_id (or kb_id/knowledge_id) is required for…
- Embedding model( ) not found
- Miss parameter
- 101
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/9c626562d8e0c379.
Report an issue: GitHub.
Appendix: source
Thrown at api/db/services/dialog_service.py:359
yield {"answer": "", "reference": {}, "audio_binary": None, "prompt": "", "created_at": time.time(), "final": False, **flags}
continue
yield {"answer": value, "reference": {}, "audio_binary": tts(tts_mdl, value), "prompt": "", "created_at": time.time(), "final": False}
else:
if model_config["model_type"] == "chat":
answer = await chat_mdl.async_chat(system_prompt, msg, dialog.llm_setting)
else:
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)View on GitHub (pinned to 554fb1133a)