argoproj/argo-workflows · error

--watch cannot be combined with --server-dry-run

Error message

--watch cannot be combined with --server-dry-run

What it means

--server-dry-run validates the workflow against the API server without creating it, so no run exists for --watch to observe. validateOptions in cmd/argo/commands/submit.go rejects the combination inside the cliOpts.Watch block.

Source

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

		workflows = append(workflows, wfs...)
	}

	return submitWorkflows(ctx, serviceClient, namespace, workflows, submitOpts, cliOpts)
}

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")

View on GitHub (pinned to 35bff19146)

Solutions

  1. Drop --watch when using --server-dry-run
  2. Use --server-dry-run alone for server-side validation
  3. Adjust wrapper scripts to add --watch only when neither dry-run mode is set

Example fix

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

Strategy: validation

Validate before calling

if [ -n "$SERVER_DRY_RUN" ] && echo "$FLAGS" | grep -q -- '--watch'; then
  echo "--watch cannot be combined with --server-dry-run" >&2; exit 2
fi

Prevention

When it happens

Trigger: `argo submit my-wf.yaml --server-dry-run --watch`; scripts appending --watch to every submit regardless of mode.

Common situations: CI validation pipelines with a shared submit wrapper that hardcodes --watch; migrating from real submits to dry-run validation without pruning flags.

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/e7f2fd8e2f96ffcb. Report an issue: GitHub.