argoproj/argo-workflows · error

--wait cannot be combined with --dry-run

Error message

--wait cannot be combined with --dry-run

What it means

--wait blocks until the workflow finishes, which is meaningless with --dry-run since nothing is ever created or run. validateOptions in cmd/argo/commands/submit.go rejects --wait with --dry-run (and symmetrically with --server-dry-run) after the --watch checks.

Source

Thrown at cmd/argo/commands/submit.go:154

func validateOptions(workflows []wfv1.Workflow, submitOpts *wfv1.SubmitOpts, cliOpts *common.CliSubmitOpts) error {
	if cliOpts.Watch {
		if len(workflows) > 1 {
			return errors.New("cannot watch more than one workflow")
		}
		if cliOpts.Wait {
			return errors.New("--wait cannot be combined with --watch")
		}
		if submitOpts.DryRun {
			return errors.New("--watch cannot be combined with --dry-run")
		}
		if submitOpts.ServerDryRun {
			return errors.New("--watch cannot be combined with --server-dry-run")
		}
	}

	if cliOpts.Wait {
		if submitOpts.DryRun {
			return errors.New("--wait cannot be combined with --dry-run")
		}
		if submitOpts.ServerDryRun {
			return errors.New("--wait cannot be combined with --server-dry-run")
		}
	}

	if submitOpts.DryRun {
		if cliOpts.Output.String() == "" {
			return errors.New("--dry-run should have an output option")
		}
		if submitOpts.ServerDryRun {
			return errors.New("--dry-run cannot be combined with --server-dry-run")
		}
	}

	if submitOpts.ServerDryRun {
		if cliOpts.Output.String() == "" {
			return errors.New("--server-dry-run should have an output option")

View on GitHub (pinned to 35bff19146)

Solutions

  1. Remove --wait when using --dry-run or --server-dry-run
  2. Use --dry-run alone for local rendering validation
  3. In shared wrappers, conditionally append --wait only when no dry-run flag is present

Example fix

// before
argo submit my-wf.yaml --dry-run --wait
// after
argo submit my-wf.yaml --dry-run
Defensive patterns

Strategy: validation

Validate before calling

if [ -n "$DRY_RUN" ] || [ -n "$SERVER_DRY_RUN" ]; then
  WAIT_FLAG=""  # drop --wait for dry-run modes
fi

Prevention

When it happens

Trigger: `argo submit my-wf.yaml --dry-run --wait` (or --server-dry-run --wait); CI wrappers that always append --wait to guarantee completion.

Common situations: Shared CI submit functions that hardcode --wait; adding --dry-run to debug a failing pipeline that always waits.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/12fce9c9c5c54425. Report an issue: GitHub.