{"record":{"id":"a8d1982816988356","repo":"pulumi/pulumi","slug":"operation-is-not-valid-for-drift-schedules","errorCode":null,"errorMessage":"--operation is not valid for drift schedules","messagePattern":"--operation is not valid for drift schedules","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/stack/stack_schedule_edit.go","lineNumber":238,"sourceCode":"\t\tflags.autoRemediateChanged ||\n\t\tflags.deleteAfterDestroyChanged\n}\n\nfunc validateScheduleEditFlags(kind string, flags stackScheduleEditFlags) error {\n\tswitch kind {\n\tcase scheduleKindRaw:\n\t\tif flags.autoRemediateChanged {\n\t\t\treturn errors.New(\"--auto-remediate is only valid for drift schedules\")\n\t\t}\n\t\tif flags.deleteAfterDestroyChanged {\n\t\t\treturn errors.New(\"--delete-after-destroy is only valid for ttl schedules\")\n\t\t}\n\tcase scheduleKindDrift:\n\t\tif flags.onceChanged {\n\t\t\treturn errors.New(\"--once is not valid for drift schedules; use --cron\")\n\t\t}\n\t\tif flags.operationChanged {\n\t\t\treturn errors.New(\"--operation is not valid for drift schedules\")\n\t\t}\n\t\tif flags.deleteAfterDestroyChanged {\n\t\t\treturn errors.New(\"--delete-after-destroy is only valid for ttl schedules\")\n\t\t}\n\tcase scheduleKindTTL:\n\t\tif flags.cronChanged {\n\t\t\treturn errors.New(\"--cron is not valid for ttl schedules; use --once\")\n\t\t}\n\t\tif flags.operationChanged {\n\t\t\treturn errors.New(\"--operation is not valid for ttl schedules\")\n\t\t}\n\t\tif flags.autoRemediateChanged {\n\t\t\treturn errors.New(\"--auto-remediate is only valid for drift schedules\")\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/stack/stack_schedule_edit.go#L220-L256","documentation":"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.","triggerScenarios":"Running `pulumi stack schedule edit <drift-schedule> --operation <op>` (flags.operationChanged true while kind == scheduleKindDrift).","commonSituations":"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.","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."],"exampleFix":"// before\npulumi stack schedule edit my-drift-schedule --operation refresh\n// after\npulumi stack schedule edit my-drift-schedule  # drift operation is fixed\npulumi stack schedule create --cron \"0 * * * *\" --operation refresh  # separate schedule","handlingStrategy":"validation","validationCode":"if kind === 'drift' && argvHas('--operation') {\n  throw new Error('--operation is not valid for drift schedules');\n}","typeGuard":"function isDriftSchedule(s) { return s.kind === 'drift'; }","tryCatchPattern":null,"preventionTips":["Create a separate deployment schedule instead of mutating a drift schedule's operation.","Keep drift schedules managed by drift-specific tooling only."],"tags":["cli","schedules","drift","flag-validation"],"backgroundTag":"invalid-flag-for-schedule-kind","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}