Skip to content

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

fix(prompts): handle resolvePromptGraph on deleted prompt (#6264)

Hassieb Pakzad9395e946705f
diff --git a/web/src/features/prompts/server/routers/promptRouter.ts b/web/src/features/prompts/server/routers/promptRouter.ts
index 3e8a28cc55..1786372cb9 100644
--- a/web/src/features/prompts/server/routers/promptRouter.ts
+++ b/web/src/features/prompts/server/routers/promptRouter.ts
@@ -956,13 +956,20 @@ export const promptRouter = createTRPCRouter({
scope: "prompts:read",
});
- const prompt = await ctx.prisma.prompt.findUniqueOrThrow({
+ const prompt = await ctx.prisma.prompt.findUnique({
where: {
id: promptId,
projectId,
},
});
+ if (!prompt) {
+ throw new TRPCError({
+ code: "NOT_FOUND",
+ message: "Prompt not found",
+ });
+ }
+
const promptService = new PromptService(ctx.prisma, redis);
return promptService.buildAndResolvePromptGraph({