pulumi/pulumi · error

exactly one of --cron or --once must be set

Error message

exactly one of --cron or --once must be set

What it means

Editing a schedule requires exactly one scheduling mode: either a cron expression via --cron or a one-shot timestamp via --once. Supplying neither leaves the update ambiguous, so the command fails with this error.

Source

Thrown at pkg/cmd/esc/cli/env_schedule_edit.go:67

				return err
			}

			ref, args, err := env.getExistingEnvRef(ctx, args)
			if err != nil {
				return err
			}
			if ref.version != "" {
				return errors.New("the edit command does not accept versions")
			}

			scheduleID := args[0]
			if scheduleID == "" {
				return errors.New("schedule ID cannot be empty")
			}

			switch {
			case cron == "" && once == "":
				return errors.New("exactly one of --cron or --once must be set")
			case cron != "" && once != "":
				return errors.New("only one of --cron or --once may be set")
			}

			if once != "" {
				t, err := time.Parse(time.RFC3339, once)
				if err != nil {
					return fmt.Errorf("--once must be an ISO 8601 / RFC 3339 timestamp: %w", err)
				}
				if !t.After(time.Now()) {
					return errors.New("--once must be a timestamp in the future")
				}
			}

			req := client.UpdateEnvironmentScheduleRequest{
				ScheduleCron: cron,
				ScheduleOnce: once,
			}

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Add exactly one of --cron or --once, e.g. `--cron "0 9 * * *"` or `--once 2026-09-01T09:00:00Z`
  2. If the goal is to remove the schedule, use the schedule delete/remove command instead of edit

Example fix

// before
esc env schedule edit org/proj/env sched-123
// after
esc env schedule edit org/proj/env sched-123 --cron "0 9 * * *"
Defensive patterns

Strategy: validation

Validate before calling

[ -n "$CRON" ] || [ -n "$ONCE" ] || { echo "must set --cron or --once" >&2; exit 1; }

Prevention

When it happens

Trigger: Running `esc env schedule edit <envref> <scheduleID>` without either flag, or with both flags' values empty.

Common situations: Forgetting the flag when copying a command template; intending to disable a schedule by clearing values instead of using a delete/remove command.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/5b62a03424696fa2. Report an issue: GitHub.