diff --git a/backend/src/index.ts b/backend/src/index.ts index cfba707..e4e6155 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -307,7 +307,14 @@ await fastify.register(async (instance) => { throw new Error(`Unexpected populate claim outcome: ${populateOutcome}`); } - const run = await populateWorkflow.createRun(); + let run: Awaited>; + try { + run = await populateWorkflow.createRun(); + } catch (runErr) { + req.log.error(runErr, "Failed to create workflow run; releasing dataset claim"); + await setDatasetPopulateStatus(parsed.data.datasetId, "failed", statusErrorMessage(runErr)); + return reply.code(502).send({ error: "Failed to populate dataset. Please try again." }); + } void runPopulateWorkflowInBackground({ input: parsed.data,