argoproj/argo-workflows · error

--dry-run should have an output option

Error message

--dry-run should have an output option

What it means

--dry-run submits the workflow locally (client-side validation only, nothing is sent to the server), so the rendered workflow must be printed somewhere. The CLI requires an --output format whenever --dry-run is given, otherwise the result would be silently discarded.

Source

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

			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")
		}
	}
	return nil
}

func submitWorkflowFromResource(ctx context.Context, serviceClient workflowpkg.WorkflowServiceClient, namespace string, resourceIdentifier string, submitOpts *wfv1.SubmitOpts, cliOpts *common.CliSubmitOpts) error {
	parts := strings.SplitN(resourceIdentifier, "/", 2)
	if len(parts) != 2 {
		return fmt.Errorf("resource identifier '%s' is malformed. Should be `kind/name`, e.g. cronwf/hello-world-cwf", resourceIdentifier)

View on GitHub (pinned to 35bff19146)

Solutions

  1. Add an --output flag, e.g. `argo submit workflow.yaml --dry-run --output yaml`.
  2. Use `-o json` if the result is consumed by another tool.
  3. If you actually wanted server-side validation, use --server-dry-run (also with --output) instead of --dry-run.
  4. Drop --dry-run if you intended a real submission.

Example fix

// before
argo submit workflow.yaml --dry-run
// after
argo submit workflow.yaml --dry-run --output yaml
Defensive patterns

Strategy: validation

Validate before calling

if dryRun && output == "" {
    return fmt.Errorf("--dry-run requires --output (yaml|json|wide|name)")
}

Prevention

When it happens

Trigger: Running `argo submit workflow.yaml --dry-run` without --output (e.g. --output json|yaml|wide|name); validateOptions checks cliOpts.Output.String() == "" and returns this error.

Common situations: Users adding --dry-run to an existing submit command that relied on default output behavior; scripts that pipe output but omit the --output flag; docs/examples showing --dry-run alone.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


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