{"record":{"id":"43ad79e5c364eaee","repo":"argoproj/argo-workflows","slug":"watch-cannot-be-combined-with-dry-run","errorCode":null,"errorMessage":"--watch cannot be combined with --dry-run","messagePattern":"--watch cannot be combined with --dry-run","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argo/commands/submit.go","lineNumber":145,"sourceCode":"\tvar workflows []wfv1.Workflow\n\tfor _, body := range fileContents {\n\t\twfs := unmarshalWorkflows(ctx, body, cliOpts.Strict)\n\t\tworkflows = append(workflows, wfs...)\n\t}\n\n\treturn submitWorkflows(ctx, serviceClient, namespace, workflows, submitOpts, cliOpts)\n}\n\nfunc validateOptions(workflows []wfv1.Workflow, submitOpts *wfv1.SubmitOpts, cliOpts *common.CliSubmitOpts) error {\n\tif cliOpts.Watch {\n\t\tif len(workflows) > 1 {\n\t\t\treturn errors.New(\"cannot watch more than one workflow\")\n\t\t}\n\t\tif cliOpts.Wait {\n\t\t\treturn errors.New(\"--wait cannot be combined with --watch\")\n\t\t}\n\t\tif submitOpts.DryRun {\n\t\t\treturn errors.New(\"--watch cannot be combined with --dry-run\")\n\t\t}\n\t\tif submitOpts.ServerDryRun {\n\t\t\treturn errors.New(\"--watch cannot be combined with --server-dry-run\")\n\t\t}\n\t}\n\n\tif cliOpts.Wait {\n\t\tif submitOpts.DryRun {\n\t\t\treturn errors.New(\"--wait cannot be combined with --dry-run\")\n\t\t}\n\t\tif submitOpts.ServerDryRun {\n\t\t\treturn errors.New(\"--wait cannot be combined with --server-dry-run\")\n\t\t}\n\t}\n\n\tif submitOpts.DryRun {\n\t\tif cliOpts.Output.String() == \"\" {\n\t\t\treturn errors.New(\"--dry-run should have an output option\")","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argo/commands/submit.go#L127-L163","documentation":"--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.","triggerScenarios":"`argo submit my-wf.yaml --dry-run --watch`; also --dry-run combined with --watch in scripts that unconditionally add --watch.","commonSituations":"Validating generated manifests while habitually passing --watch; testing submit flags incrementally.","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"],"exampleFix":"// before\nargo submit my-wf.yaml --dry-run --watch\n// after\nargo submit my-wf.yaml --dry-run","handlingStrategy":"validation","validationCode":"if [ -n \"$DRY_RUN\" ] && echo \"$FLAGS\" | grep -q -- '--watch'; then\n  echo \"--watch cannot be combined with --dry-run\" >&2; exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","flag-conflict","argo-cli","submit","dry-run"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}