pulumi/pulumi · error

--once %w

Error message

--once %w

What it means

The --once flag of `pulumi stack schedule new` accepts a timestamp for a one-off schedule. Before use it is normalized by parseScheduleTimestamp; if the value cannot be parsed as a valid timestamp, the error is wrapped as "--once <reason>". It is a flag-value validation error raised before creating the schedule.

Source

Thrown at pkg/cmd/pulumi/stack/stack_schedule_new.go:259

	return RequireCloudStack(ctx, cmdutil.Diag(), pkgWorkspace.Instance, cmdBackend.DefaultLoginManager, stackFlag)
}

func runStackScheduleNew(
	ctx context.Context,
	w io.Writer,
	factory stackScheduleNewClientFactory,
	args stackScheduleNewArgs,
	render scheduleGetRenderFunc,
) error {
	kind := strings.ToLower(strings.TrimSpace(args.kind))
	if err := validateScheduleNewArgs(kind, args); err != nil {
		return err
	}

	if args.once != "" {
		normalized, err := parseScheduleTimestamp(args.once)
		if err != nil {
			return fmt.Errorf("--once %w", err)
		}
		args.once = normalized
	}

	c, stackID, err := factory(ctx, args.stack)
	if err != nil {
		return err
	}

	var schedule apitype.ScheduledAction
	switch kind {
	case scheduleKindRaw:
		op, opErr := parseScheduleOperation(args.operation)
		if opErr != nil {
			return opErr
		}
		schedule, err = c.CreateStackSchedule(ctx, stackID, apitype.CreateScheduledDeploymentRequest{
			ScheduleCron: args.cron,

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Pass an RFC3339/ISO-8601 timestamp, e.g. --once "2026-08-31T02:00:00Z".
  2. Quote the timestamp so the shell doesn't split it.
  3. Check the inner wrapped message after "--once" for the exact parse failure.
  4. Use --cron instead if a repeating schedule was intended.

Example fix

// before
pulumi stack schedule new --kind raw --name once --operation update --once "tomorrow at 2am" --yes
// after
pulumi stack schedule new --kind raw --name once --operation update --once "2026-08-31T02:00:00Z" --yes
Defensive patterns

Strategy: validation

Validate before calling

t, err := time.Parse(time.RFC3339, onceValue)
if err != nil {
    return fmt.Errorf("--once must be RFC3339, got %q", onceValue)
}
if !t.After(time.Now()) {
    return errors.New("--once must be in the future")
}

Try / catch

if err := pulumiScheduleNew(onceArg); err != nil {
    if strings.HasPrefix(err.Error(), "--once") {
        return fmt.Errorf("bad --once timestamp: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Running `pulumi stack schedule new ... --once <value>` where <value> is not a parseable/normalizable timestamp — wrong format, ambiguous date, or non-ISO layout.

Common situations: Passing human dates like "tomorrow 5pm" or "08/30/2026" in an unexpected layout; missing timezone producing an invalid value; shell quoting stripping parts of the timestamp.

Related errors


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