infiniflow/ragflow · error · Exception

OCR model name is required

Error message

OCR model name is required

What it means

Error "OCR model name is required" thrown in infiniflow/ragflow.

Source

Thrown at api/db/joint_services/tenant_model_service.py:192

            model_id = tenant.tenant_embd_id
            model_name = tenant.embd_id
        case LLMType.ASR.value:
            model_id = tenant.tenant_asr_id
            model_name = tenant.asr_id
        case LLMType.VISION.value:
            model_id = tenant.tenant_img2txt_id
            model_name = tenant.img2txt_id
        case LLMType.CHAT.value:
            model_id = tenant.tenant_llm_id
            model_name = tenant.llm_id
        case LLMType.RERANK.value:
            model_id = tenant.tenant_rerank_id
            model_name = tenant.rerank_id
        case LLMType.TTS.value:
            model_id = tenant.tenant_tts_id
            model_name = tenant.tts_id
        case LLMType.OCR.value:
            raise Exception("OCR model name is required")
        case _:
            raise Exception(f"Unknown model type {model_type}")
    if not model_name:
        raise Exception(f"No default {model_type} model is set.")
    # Prefer resolving by tenant_model.id when available
    if model_id:
        try:
            return get_model_config_by_id(tenant_id, model_type, model_id)
        except LookupError:
            logger.warning("tenant_model id=%s not found, falling back to model_name lookup for %s", model_id, model_name)
    return resolve_model_config(tenant_id, model_type, model_name)


def split_model_name(model_name: str):
    # Parse model_name: {model_name} or {model_name}@{factory_name} or {model_name}@{instance_name}@{factory_name}
    #
    # The composite key is right-anchored on the provider: the *last* '@'-separated
    # field is the factory/provider, the second-to-last is the instance (when

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Provide the OCR model name when configuring an OCR model type.

Example fix

params = {'model_type': 'ocr', 'ocr_model_name': 'deepdoc-ocr'}

When it happens

Trigger: Thrown at api/db/joint_services/tenant_model_service.py:192 when the library encounters an invalid state.

Common situations: An OCR model resolution request omits the required model name; supplying it prevents this error.


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