{"record":{"id":"5b62a03424696fa2","repo":"pulumi/pulumi","slug":"exactly-one-of-cron-or-once-must-be-set","errorCode":null,"errorMessage":"exactly one of --cron or --once must be set","messagePattern":"exactly one of --cron or --once must be set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/esc/cli/env_schedule_edit.go","lineNumber":67,"sourceCode":"\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tref, args, err := env.getExistingEnvRef(ctx, args)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif ref.version != \"\" {\n\t\t\t\treturn errors.New(\"the edit command does not accept versions\")\n\t\t\t}\n\n\t\t\tscheduleID := args[0]\n\t\t\tif scheduleID == \"\" {\n\t\t\t\treturn errors.New(\"schedule ID cannot be empty\")\n\t\t\t}\n\n\t\t\tswitch {\n\t\t\tcase cron == \"\" && once == \"\":\n\t\t\t\treturn errors.New(\"exactly one of --cron or --once must be set\")\n\t\t\tcase cron != \"\" && once != \"\":\n\t\t\t\treturn errors.New(\"only one of --cron or --once may be set\")\n\t\t\t}\n\n\t\t\tif once != \"\" {\n\t\t\t\tt, err := time.Parse(time.RFC3339, once)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"--once must be an ISO 8601 / RFC 3339 timestamp: %w\", err)\n\t\t\t\t}\n\t\t\t\tif !t.After(time.Now()) {\n\t\t\t\t\treturn errors.New(\"--once must be a timestamp in the future\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treq := client.UpdateEnvironmentScheduleRequest{\n\t\t\t\tScheduleCron: cron,\n\t\t\t\tScheduleOnce: once,\n\t\t\t}","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/esc/cli/env_schedule_edit.go#L49-L85","documentation":"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.","triggerScenarios":"Running `esc env schedule edit <envref> <scheduleID>` without either flag, or with both flags' values empty.","commonSituations":"Forgetting the flag when copying a command template; intending to disable a schedule by clearing values instead of using a delete/remove command.","solutions":["Add exactly one of --cron or --once, e.g. `--cron \"0 9 * * *\"` or `--once 2026-09-01T09:00:00Z`","If the goal is to remove the schedule, use the schedule delete/remove command instead of edit"],"exampleFix":"// before\nesc env schedule edit org/proj/env sched-123\n// after\nesc env schedule edit org/proj/env sched-123 --cron \"0 9 * * *\"","handlingStrategy":"validation","validationCode":"[ -n \"$CRON\" ] || [ -n \"$ONCE\" ] || { echo \"must set --cron or --once\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include exactly one scheduling flag","Use shell wrappers that enforce required flags","Check --help before constructing commands"],"tags":["cli","esc","flags"],"backgroundTag":"missing-required-flag","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}