Trigger.dev replay reuses the payload: key the Sume submit from it

A Trigger.dev replay starts a new run with the same payload. Derive the Sume Idempotency-Key from that payload, not a random id, or a replay bills twice.

4 min readSume
All posts

A replay is a new run, so anything random inside the task changes. If the task derives its Sume Idempotency-Key from the payload, a replay of the same payload returns the original job instead of billing a second one. If it uses a random key, a replay pays again.

Trigger.dev facts are from its Runs docs and v4.6.1 changelog; Sume facts from Communication modes and Errors and credits, read 2026-10-01.

What does Replay do?

The Runs docs say Replay creates a new run with the same payload, using the latest task version. The page does not say what happens to an idempotency key you passed when triggering, so do not rely on one. The v4.6.1 changelog adds CLI commands runs list, runs get, runs replay and runs cancel, so replays can now happen from scripts as well as the dashboard.

Which key survives a replay?

Only a key built from payload fields. Sume treats an exact retry of the same operation and payload under one key as the same job. A different payload under the same key is 409 idempotency_conflict.

Key source versus replay outcome, from the Trigger.dev and Sume docs read 2026-10-01
Key sourceReplay of same payloadResult
Payload fields (order id, revision)Same keyOriginal Sume job returned
crypto.randomUUID() in the taskNew keyA second paid job
Payload fields, edited promptSame key, new payload409 idempotency_conflict

How do you write it?

Put a revision number in the payload. Bump it when you truly want a new render, and leave it alone for a retry or replay of the same one. Throw on an API error so Trigger.dev's retry logic sees it.

import { task } from "@trigger.dev/sdk";
import { createSumeClient, generateVideoV1 } from "@sume-com/sdk";

const client = createSumeClient({ apiKey: process.env.SUME_API_KEY! });

export const makeVideo = task({
  id: "make-video",
  run: async (payload: { orderId: string; prompt: string; revision: number }) => {
    const { data, error } = await generateVideoV1({
      client,
      headers: {
        "idempotency-key": "video-" + payload.orderId + "-r" + payload.revision,
      },
      body: { prompt: payload.prompt, mode: "async" },
    });
    if (error) throw new Error(JSON.stringify(error));
    return { jobId: data!.data.request_id };
  },
});

What if you want a fresh render on replay?

Then replay is the wrong tool for it. Trigger a new run with a higher revision. A replay uses the latest task version with the old payload, which is for repeating, not for changing.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume