argoproj/argo-workflows · error
--watch cannot be combined with --dry-run
Error message
--watch cannot be combined with --dry-run
What it means
--dry-run renders the workflow without running it, so there is nothing to watch; --watch tracks a live run. validateOptions in cmd/argo/commands/submit.go rejects --watch with --dry-run before any API call.
Source
Thrown at cmd/argo/commands/submit.go:145
var workflows []wfv1.Workflow
for _, body := range fileContents {
wfs := unmarshalWorkflows(ctx, body, cliOpts.Strict)
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")View on GitHub (pinned to 35bff19146)
Solutions
- Remove --watch when using --dry-run
- Use --dry-run alone to print the rendered workflow
- Use --server-dry-run alone (without --watch) to validate against the API server
Example fix
// before argo submit my-wf.yaml --dry-run --watch // after argo submit my-wf.yaml --dry-run
Defensive patterns
Strategy: validation
Validate before calling
if [ -n "$DRY_RUN" ] && echo "$FLAGS" | grep -q -- '--watch'; then echo "--watch cannot be combined with --dry-run" >&2; exit 2 fi
Prevention
- Never pair --watch with any dry-run flag
- Validate manifests with --dry-run separately from run-watching
- Strip --watch in wrapper scripts when DRY_RUN is set
When it happens
Trigger: `argo submit my-wf.yaml --dry-run --watch`; also --dry-run combined with --watch in scripts that unconditionally add --watch.
Common situations: Validating generated manifests while habitually passing --watch; testing submit flags incrementally.
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
- --watch cannot be combined with --server-dry-run
- --wait cannot be combined with --dry-run
- cannot combine --from with file arguments
- cannot watch more than one workflow
- --wait cannot be combined with --watch
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/43ad79e5c364eaee.
Report an issue: GitHub.