pulumi/pulumi · error
--operation is not valid for drift schedules
Error message
--operation is not valid for drift schedules
What it means
The --operation flag selects a deployment operation (e.g. refresh/destroy) for schedules that support it. Drift schedules have a fixed operation (drift detection), so editing a drift schedule with --operation is rejected by validateScheduleEditFlags.
Source
Thrown at pkg/cmd/pulumi/stack/stack_schedule_edit.go:238
flags.autoRemediateChanged ||
flags.deleteAfterDestroyChanged
}
func validateScheduleEditFlags(kind string, flags stackScheduleEditFlags) error {
switch kind {
case scheduleKindRaw:
if flags.autoRemediateChanged {
return errors.New("--auto-remediate is only valid for drift schedules")
}
if flags.deleteAfterDestroyChanged {
return errors.New("--delete-after-destroy is only valid for ttl schedules")
}
case scheduleKindDrift:
if flags.onceChanged {
return errors.New("--once is not valid for drift schedules; use --cron")
}
if flags.operationChanged {
return errors.New("--operation is not valid for drift schedules")
}
if flags.deleteAfterDestroyChanged {
return errors.New("--delete-after-destroy is only valid for ttl schedules")
}
case scheduleKindTTL:
if flags.cronChanged {
return errors.New("--cron is not valid for ttl schedules; use --once")
}
if flags.operationChanged {
return errors.New("--operation is not valid for ttl schedules")
}
if flags.autoRemediateChanged {
return errors.New("--auto-remediate is only valid for drift schedules")
}
}
return nil
}
View on GitHub (pinned to 793f7b2e16)
Solutions
- Remove --operation when editing a drift schedule.
- To run refresh/destroy on a schedule, create or edit a raw or TTL deployment schedule with the desired --operation.
- Keep drift schedules dedicated to drift detection and adjust their --cron only.
Example fix
// before pulumi stack schedule edit my-drift-schedule --operation refresh // after pulumi stack schedule edit my-drift-schedule # drift operation is fixed pulumi stack schedule create --cron "0 * * * *" --operation refresh # separate schedule
Defensive patterns
Strategy: validation
Validate before calling
if kind === 'drift' && argvHas('--operation') {
throw new Error('--operation is not valid for drift schedules');
} Type guard
function isDriftSchedule(s) { return s.kind === 'drift'; } Prevention
- Create a separate deployment schedule instead of mutating a drift schedule's operation.
- Keep drift schedules managed by drift-specific tooling only.
When it happens
Trigger: Running `pulumi stack schedule edit <drift-schedule> --operation <op>` (flags.operationChanged true while kind == scheduleKindDrift).
Common situations: Users try to change what a drift schedule does (e.g. make it run refresh or destroy) instead of creating a deployment schedule of the appropriate kind.
Related errors
- --once is not valid for drift schedules; use --cron
- --auto-remediate is only valid for drift schedules
- --delete-after-destroy is only valid for ttl schedules
- --cron is not valid for ttl schedules; use --once
- --operation is not valid for ttl schedules
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/a8d1982816988356.
Report an issue: GitHub.