{"record":{"id":"238cc841eaf4e0d8","repo":"BerriAI/litellm","slug":"router-not-initialized-cannot-use-model-based-rou","errorCode":null,"errorMessage":"Router not initialized. Cannot use model-based routing.","messagePattern":"Router not initialized\\. Cannot use model-based routing\\.","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/openai_files_endpoints/common_utils.py","lineNumber":310,"sourceCode":"):\n    \"\"\"\n    Retrieve API credentials for a model from the LLM Router.\n\n    Args:\n        llm_router: LiteLLM Router instance\n        model_id: Model name or deployment ID\n        operation_context: Description for error messages (e.g., \"file upload\", \"batch creation\")\n\n    Returns:\n        Dictionary with credentials (api_key, api_base, custom_llm_provider, etc.)\n\n    Raises:\n        HTTPException: If router not initialized or model not found\n    \"\"\"\n    from fastapi import HTTPException\n\n    if llm_router is None:\n        raise HTTPException(\n            status_code=500,\n            detail={\"error\": \"Router not initialized. Cannot use model-based routing.\"},\n        )\n\n    credentials: Final = llm_router.get_deployment_credentials_with_provider(model_id=model_id)\n\n    if credentials is None:\n        raise HTTPException(\n            status_code=400,\n            detail={\"error\": f\"Model '{model_id}' not found in model_list. Please check your config.yaml.\"},\n        )\n\n    return credentials\n\n\ndef get_team_provider_credentials(\n    llm_router: Optional[\"Router\"],\n    user_api_key_dict: \"UserAPIKeyAuth\",","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/openai_files_endpoints/common_utils.py#L292-L328","documentation":"HTTPException(500) from the model-credential resolver in the files/batch proxy utils: llm_router is None — the proxy has no LiteLLM Router initialized (no models loaded) — so model-based routing to fetch provider credentials is impossible. The operator must add models to the proxy config.","triggerScenarios":"Thrown at litellm/proxy/openai_files_endpoints/common_utils.py:310 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add models to the proxy config so the router is initialized, or avoid model-based routing for this request."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}