Skip to content

bug: Imperative schedules created without declarative tasks are invisible in the UI but block deployment #3209

@isshaddad

Description

@isshaddad

Provide environment information

n/a

Describe the bug

Schedules created imperatively via schedules.create() don't appear in the Schedules tab when there is no current successful deployment for that environment. They still count against the schedule limit and keep firing runs, but there is no way to view or delete them from the dashboard. This creates a deadlock: the schedules block deployment, and the failed deployment hides the schedules.

Reproduction repo

n/a

To reproduce

  1. Create 10 scheduled tasks and deploy successfully (declarative schedules are auto-created on deploy)
  2. Remove all 10 tasks from code and redeploym, schedules are cleared
  3. Imperatively create 10 schedules via schedules.create() using a unique deduplicationKey each time (simulating CI runs without a stable key):
await schedules.create({
task: "scheduled-task-1",
cron: "* * * * *",
deduplicationKey: `ci-run-${Date.now()}`,
});
// repeat for 10 tasks
  1. Go to the Schedules tab → shows 0 schedules despite 10 existing in the DB
  2. Try to deploy the 10 scheduled tasks again → fails with You have created 10/10 schedules

Additional information

Workaround: Use a stable deduplicationKey in CI so repeated runs upsert instead of creating new schedules. If you're already over the limit, you can clean up with a loop: call schedules.list() and then schedules.del() for each returned schedule (e.g. from a one-off script or task).

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