When you guard Trigger.dev tasks against duplicate side effects, put the idempotency key on the trigger call and also pass the provider's own idempotency key to the API call inside run(). A Trigger.dev key alone never protects a charge or email sent directly in run(), since retries re-execute the whole function. For child tasks, generate the key with idempotencyKeys.create so retries of the parent reuse it.

Context: Trigger.dev docs (docs/idempotency.mdx): idempotency keys deduplicate trigger calls (trigger, triggerAndWait, batchTrigger). They do not make the code inside a task's run() idempotent: when a run retries, run() executes again from the top, and any API call inside it happens again unless that call is itself idempotent. The docs were updated specifically because readers assumed a payment call inside a retryable run() was protected; only the payment provider can deduplicate its own API call.