Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(ui): add "not found" error page for unknown traces and sessions (#4548)

Marc Klingen004aee9f35fb
diff --git a/web/src/components/error-page.tsx b/web/src/components/error-page.tsx
index 770148ebed..8228fb1e7e 100644
--- a/web/src/components/error-page.tsx
+++ b/web/src/components/error-page.tsx
@@ -13,10 +13,15 @@ export const ErrorPage = ({
}: {
title?: string;
message: string;
- additionalButton?: {
- label: string;
- href: string;
- };
+ additionalButton?:
+ | {
+ label: string;
+ href: string;
+ }
+ | {
+ label: string;
+ onClick: () => void;
+ };
}) => {
const session = useSession();
const router = useRouter();
@@ -40,9 +45,15 @@ export const ErrorPage = ({
</Button>
) : null}
{additionalButton ? (
- <Button variant="secondary" asChild>
- <Link href={additionalButton.href}>{additionalButton.label}</Link>
- </Button>
+ "onClick" in additionalButton ? (
+ <Button variant="secondary" onClick={additionalButton.onClick}>
+ {additionalButton.label}
+ </Button>
+ ) : (
+ <Button variant="secondary" asChild>
+ <Link href={additionalButton.href}>{additionalButton.label}</Link>
+ </Button>
+ )
) : null}
</div>
</div>
diff --git a/web/src/components/session/index.tsx b/web/src/components/session/index.tsx
index 536af7bc43..1556ed3ce4 100644
--- a/web/src/components/session/index.tsx
+++ b/web/src/components/session/index.tsx
@@ -37,7 +37,11 @@ export const SessionPage: React.FC<{
},
{
retry(failureCount, error) {
- if (error.data?.code === "UNAUTHORIZED") return false;
+ if (
+ error.data?.code === "UNAUTHORIZED" ||
+ error.data?.code === "NOT_FOUND"
+ )
+ return false;
return failureCount < 3;
},
},
@@ -68,6 +72,18 @@ export const SessionPage: React.FC<{
if (session.error?.data?.code === "UNAUTHORIZED")
return <ErrorPage message="You do not have access to this session." />;
+ if (session.error?.data?.code === "NOT_FOUND")
+ return (
+ <ErrorPage
+ title="Session not found"
+ message="The session is either still being processed or has been deleted."
+ additionalButton={{
+ label: "Retry",
+ onClick: () => void window.location.reload(),
+ }}
+ />
+ );
+
return (
<ScrollScreenPage>
<Header
diff --git a/web/src/components/trace/index.tsx b/web/src/components/trace/index.tsx
index 3659454834..1dc10025c8 100644
--- a/web/src/components/trace/index.tsx
+++ b/web/src/components/trace/index.tsx
@@ -268,7 +268,11 @@ export function TracePage({
},
{
retry(failureCount, error) {
- if (error.data?.code === "UNAUTHORIZED") return false;
+ if (
+ error.data?.code === "UNAUTHORIZED" ||
+ error.data?.code === "NOT_FOUND"
+ )
+ return false;
return failureCount < 3;
},
},
@@ -309,7 +313,21 @@ export function TracePage({
if (trace.error?.data?.code === "UNAUTHORIZED")
return <ErrorPage message="You do not have access to this trace." />;
+
+ if (trace.error?.data?.code === "NOT_FOUND")
+ return (
+ <ErrorPage
+ title="Trace not found"
+ message="The trace is either still being processed or has been deleted."
+ additionalButton={{
+ label: "Retry",
+ onClick: () => void window.location.reload(),
+ }}
+ />
+ );
+
if (!trace.data) return <div>loading...</div>;
+
return (
<FullScreenPage>
<Header