Skip to content

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

chore: skip not found jobs for exports (#9777)

Max Deichmann7973976fea98
diff --git a/worker/src/features/batchExport/handleBatchExportJob.ts b/worker/src/features/batchExport/handleBatchExportJob.ts
index e7143936c4..2a144dc360 100644
--- a/worker/src/features/batchExport/handleBatchExportJob.ts
+++ b/worker/src/features/batchExport/handleBatchExportJob.ts
@@ -4,6 +4,7 @@ import {
BatchExportQuerySchema,
BatchExportStatus,
exportOptions,
+ LangfuseNotFoundError,
} from "@langfuse/shared";
import { prisma } from "@langfuse/shared/src/db";
import {
@@ -48,7 +49,7 @@ export const handleBatchExportJob = async (
});
if (!jobDetails) {
- throw new Error(
+ throw new LangfuseNotFoundError(
`Job not found for project: ${projectId} and export ${batchExportId}`,
);
}
diff --git a/worker/src/queues/batchExportQueue.ts b/worker/src/queues/batchExportQueue.ts
index 28a6ab046e..658bd3fd7d 100644
--- a/worker/src/queues/batchExportQueue.ts
+++ b/worker/src/queues/batchExportQueue.ts
@@ -1,6 +1,10 @@
import { Job } from "bullmq";
-import { BaseError, BatchExportStatus } from "@langfuse/shared";
+import {
+ BaseError,
+ BatchExportStatus,
+ LangfuseNotFoundError,
+} from "@langfuse/shared";
import { kyselyPrisma } from "@langfuse/shared/src/db";
import { traceException, logger } from "@langfuse/shared/src/server";
@@ -18,6 +22,12 @@ export const batchExportQueueProcessor = async (
return true;
} catch (e) {
+ if (e instanceof LangfuseNotFoundError) {
+ logger.warn(
+ `Batch export ${job.data.payload.batchExportId} not found. Job will be skipped.`,
+ );
+ return true;
+ }
const displayError =
e instanceof BaseError ? e.message : "An internal error occurred";