diff --git a/ui/litellm-dashboard/src/components/model_info_view.test.tsx b/ui/litellm-dashboard/src/components/model_info_view.test.tsx index 3db9418dfb9..203fb3ff46d 100644 --- a/ui/litellm-dashboard/src/components/model_info_view.test.tsx +++ b/ui/litellm-dashboard/src/components/model_info_view.test.tsx @@ -303,7 +303,28 @@ describe("ModelInfoView", () => { await user.click(testButton); await waitFor(() => { - expect(mockToast.error).toHaveBeenCalled(); + expect(mockToast.fromError).toHaveBeenCalled(); + }); + }); + + it("should not truncate the connection test error message", async () => { + // Regression test: the error toast used to cut the message to 100 chars + // via truncateString, hiding the actual provider error from the user. + const user = userEvent.setup(); + const longMessage = "Bedrock_mantleException - " + "x".repeat(150); + mockTestConnectionRequest.mockRejectedValue(new Error(longMessage)); + + render(, { wrapper }); + + await waitFor(() => { + expect(screen.getByText("Model Settings")).toBeInTheDocument(); + }); + + const testButton = screen.getByRole("button", { name: /test connection/i }); + await user.click(testButton); + + await waitFor(() => { + expect(mockToast.fromError).toHaveBeenCalledWith(expect.stringContaining(longMessage)); }); }); diff --git a/ui/litellm-dashboard/src/components/model_info_view.tsx b/ui/litellm-dashboard/src/components/model_info_view.tsx index 35afcdb2985..caa373a0f4b 100644 --- a/ui/litellm-dashboard/src/components/model_info_view.tsx +++ b/ui/litellm-dashboard/src/components/model_info_view.tsx @@ -13,7 +13,6 @@ import { ArrowLeft, CheckIcon, CopyIcon, Info } from "lucide-react"; import { useEffect, useMemo, useState } from "react"; import { copyToClipboard as utilCopyToClipboard } from "../utils/dataUtils"; import { stripMaskedSecrets } from "../utils/maskedSecretUtils"; -import { truncateString } from "../utils/textUtils"; import AutoRouterConnectionTest from "./add_model/auto_router_connection_test"; import { AutoRouterTestTarget, buildAutoRouterTestTargets } from "./add_model/build_auto_router_test_targets"; import { normalizeTierModels } from "./add_model/complexity_router_tiers"; @@ -530,11 +529,7 @@ export default function ModelInfoView({ throw new Error(response?.result?.error || response?.message || "Unknown error"); } } catch (error) { - if (error instanceof Error) { - toast.error("Error testing connection: " + truncateString(error.message, 100)); - } else { - toast.error("Error testing connection: " + String(error)); - } + toast.fromError("Error testing connection: " + (error instanceof Error ? error.message : String(error))); } };