{"record":{"id":"20cd829affbf4b73","repo":"BerriAI/litellm","slug":"server-error","errorCode":null,"errorMessage":"server error","messagePattern":"server error","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"litellm-rust/crates/ai-gateway/src/main.rs","lineNumber":86,"sourceCode":"    }\n\n    let state = AppState {\n        router,\n        master_key,\n        loggers: Arc::new(loggers),\n        realtime_pool,\n    };\n\n    let host = std::env::var(\"HOST\").unwrap_or_else(|_| DEFAULT_HOST.to_string());\n    let port = resolve_port();\n\n    let listener = tokio::net::TcpListener::bind((host.as_str(), port))\n        .await\n        .expect(\"failed to bind listener\");\n    eprintln!(\"litellm-ai-gateway listening on {host}:{port}\");\n    axum::serve(listener, routes::app(state))\n        .await\n        .expect(\"server error\");\n}\n\n/// Register every deployment's upstream key with the pool so the replenisher\n/// pre-warms it. Mirrors `service::run`'s key derivation (strip `openai/`, resolve\n/// api_key); deployments whose key can't be resolved are skipped (they fresh-dial\n/// and surface the auth error on the request path, as before).\nfn register_deployments(router: &Router, pool: &RealtimePool) {\n    for deployment in router.deployments() {\n        let params = &deployment.litellm_params;\n        let provider_model = params\n            .model\n            .strip_prefix(\"openai/\")\n            .unwrap_or(&params.model);\n        if let Some(key) = upstream_key(\n            provider_model,\n            params.api_key.as_deref(),\n            params.api_base.as_deref(),\n        ) {","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm-rust/crates/ai-gateway/src/main.rs#L68-L104","documentation":"Error \"server error\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm-rust/crates/ai-gateway/src/main.rs:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the gateway logs for the underlying server error (panic, connection loss) and restart after fixing the cause."],"exampleFix":null,"handlingStrategy":null,"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"}