infiniflow/ragflow · error · LookupError
Model {model_name} not found for model {model_type_val}
Error message
Model {model_name} not found for model {model_type_val} What it means
Error "Model {model_name} not found for model {model_type_val}" thrown in infiniflow/ragflow.
Source
Thrown at api/db/joint_services/tenant_model_service.py:321
"llm_factory": provider_obj.provider_name,
"api_key": api_key,
"llm_name": model_obj.model_name,
"api_base": extra_fields.get("base_url", ""),
"model_type": model_type_val,
"is_tools": model_extra.get("is_tools", is_tool),
"max_tokens": max_tokens,
}
if provider_name.lower() == "somark":
# SoMark/OCR factories read parser config (somark_*, parse_method, ...)
# from model_config["extra"]; see tenant_llm_service.LLMBundle OCR path.
model_config["extra"] = model_extra
if api_key_payload is not None:
model_config["api_key_payload"] = api_key_payload
return model_config
else:
raise LookupError(f"Model {model_name} not found for model {model_type_val}")
def get_model_config_by_id(tenant_id: str, model_type: str | enum.Enum, model_id: str):
"""Get model config from tenant_model by its id (CharField PK)."""
model_type_val = model_type if isinstance(model_type, str) else model_type.value
model_type_bin = calculate_model_type(model_type_val)
exist, model_obj = TenantModelService.get_by_id(model_id)
if not exist:
raise LookupError(f"TenantModel id={model_id} not found.")
if model_obj.status == ActiveStatusEnum.INACTIVE.value:
raise LookupError(f"TenantModel id={model_id} is disabled.")
if model_obj.status == ActiveStatusEnum.UNSUPPORTED.value:
raise LookupError(f"TenantModel id={model_id} cannot be used as {model_type_val} model.")
if not (model_obj.model_type & model_type_bin):
raise LookupError(f"TenantModel id={model_id} cannot be used as {model_type_val} model.")
ok, provider_obj = TenantModelProviderService.get_by_id(model_obj.provider_id)
if not ok:View on GitHub (pinned to 554fb1133a)
Solutions
- Verify the model name and type exist for the tenant.
- Configure the model in the tenant model settings first.
Example fix
# check available models for the tenant before referencing one
When it happens
Trigger: Thrown at api/db/joint_services/tenant_model_service.py:321 when the library encounters an invalid state.
Common situations: The requested model is not configured for the tenant under the given type; adding or correcting the model configuration prevents this error.
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/1d8f40c4d324f912.
Report an issue: GitHub.