{"record":{"id":"1fa892880dfb56bd","repo":"infiniflow/ragflow","slug":"tenant-not-found","errorCode":null,"errorMessage":"Tenant not found","messagePattern":"Tenant not found","errorType":"exception","errorClass":"LookupError","httpStatus":null,"severity":"error","filePath":"api/db/joint_services/tenant_model_service.py","lineNumber":168,"sourceCode":"        \"MinerU\",\n        \"mineru-from-env\",\n        _collect_env_config(MINERU_ENV_KEYS, MINERU_DEFAULT_CONFIG),\n    )\n\n\ndef ensure_paddleocr_from_env(tenant_id: str) -> str | None:\n    return _ensure_ocr_provider_from_env(\n        tenant_id,\n        \"PaddleOCR\",\n        \"paddleocr-from-env\",\n        _collect_env_config(PADDLEOCR_ENV_KEYS, PADDLEOCR_DEFAULT_CONFIG),\n    )\n\n\ndef get_tenant_default_model_by_type(tenant_id: str, model_type: str | enum.Enum):\n    exist, tenant = TenantService.get_by_id(tenant_id)\n    if not exist:\n        raise LookupError(\"Tenant not found\")\n    model_type_val = model_type if isinstance(model_type, str) else model_type.value\n    model_id: str | None = None\n    model_name: str = \"\"\n    match model_type_val:\n        case LLMType.EMBEDDING.value:\n            model_id = tenant.tenant_embd_id\n            model_name = tenant.embd_id\n        case LLMType.ASR.value:\n            model_id = tenant.tenant_asr_id\n            model_name = tenant.asr_id\n        case LLMType.VISION.value:\n            model_id = tenant.tenant_img2txt_id\n            model_name = tenant.img2txt_id\n        case LLMType.CHAT.value:\n            model_id = tenant.tenant_llm_id\n            model_name = tenant.llm_id\n        case LLMType.RERANK.value:\n            model_id = tenant.tenant_rerank_id","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/api/db/joint_services/tenant_model_service.py#L150-L186","documentation":"Error \"Tenant not found\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at api/db/joint_services/tenant_model_service.py:168 when the library encounters an invalid state.","commonSituations":"A model lookup is performed with an unknown or deleted tenant id; validating the tenant beforehand prevents this error.","solutions":["Verify the tenant_id exists in the tenant table.","Ensure the request is scoped to a valid tenant."],"exampleFix":"tenant = TenantService.get_by_id(tenant_id)\nif not tenant:\n    raise ValueError('Tenant not found')","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}