Skip to content

Throw when duplicate task ids are defined #3654

@capaj

Description

@capaj

Feature request

Trigger.dev should fail fast when two tasks are defined with the same id in a project.

Current behavior

With Trigger.dev v4.4.6, if two task files define the same task id, the project can still build/deploy. The later definition appears to overwrite the earlier one silently in the resource catalog.

This can lead to surprising production behavior. For example, one task definition may set:

maxDuration: 7200

while an older duplicate task file with the same id sets:

maxDuration: 1800

The deployed task can then time out after 30 minutes even though the active source file a developer is looking at says 2 hours.

Expected behavior

During local dev startup, indexing, dry-run deploy, or deploy, Trigger.dev should throw an error when duplicate task ids are found.

The error should ideally include:

  • the duplicated task id
  • both file paths / entrypoints
  • a short explanation that task ids must be unique inside a project

Example:

Duplicate Trigger.dev task id "campaign-sync-single-account" found:
- packages/trigger/campaignSyncSingleAccountTask.ts
- packages/trigger/campaignSyncAccountTask.ts

Task ids must be unique. Rename or remove one of these task definitions.

Why this matters

Silent overriding makes debugging very difficult because the UI/runtime behavior can contradict the task definition a developer is inspecting. A build-time or startup error would prevent accidental production deploys with stale duplicate task files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions