argoproj/argo-workflows · error

requires either a workflow or other argument

Error message

requires either a workflow or other argument

What it means

The 'argo delete' command requires an explicit target: at least one workflow name argument (including @latest style tokens) or a filter flag like --selector / --all / --completed / --older / --newer. Cobra's Args validator rejects bare 'argo delete' to prevent accidental mass deletion.

Source

Thrown at cmd/argo/commands/delete.go:43

		hasFilterFlag = func() bool {
			return all || allNamespaces || flags.completed || flags.resubmitted || flags.prefix != "" ||
				flags.labels != "" || flags.fields != "" || flags.finishedBefore != "" || len(flags.status) > 0
		}
	)
	command := &cobra.Command{
		Use:   "delete [--dry-run] [WORKFLOW...|[--all] [--older] [--completed] [--resubmitted] [--prefix PREFIX] [--selector SELECTOR] [--force] [--status STATUS] ]",
		Short: "delete workflows",
		Example: `# Delete a workflow:

  argo delete my-wf

# Delete the latest workflow:

  argo delete @latest
`,
		Args: func(cmd *cobra.Command, args []string) error {
			if len(args) == 0 && !hasFilterFlag() {
				return errors.New("requires either a workflow or other argument")
			}
			return nil
		},
		RunE: func(cmd *cobra.Command, args []string) error {
			ctx := cmd.Context()
			ctx, apiClient, err := client.NewAPIClient(ctx)
			if err != nil {
				return err
			}
			serviceClient := apiClient.NewWorkflowServiceClient(ctx)
			var workflows wfv1.Workflows
			if !allNamespaces {
				flags.namespace = client.Namespace(ctx)
			}
			for _, name := range args {
				workflows = append(workflows, wfv1.Workflow{
					ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: flags.namespace},
				})

View on GitHub (pinned to 35bff19146)

Solutions

  1. Name the workflow: argo delete my-wf or use @latest: argo delete @latest.
  2. Use a filter: argo delete --all, --selector workflows.argoproj.io/phase=Failed, or --older 24h.
  3. Guard scripts to substitute a real name before calling delete.

Example fix

// before
argo delete   # no target -> error
// after
argo delete @latest
Defensive patterns

Strategy: validation

Validate before calling

if [ $# -eq 0 ] && [ -z "$SELECTOR" ] && [ -z "$ALL" ]; then
  echo 'argo delete needs a workflow or filter flag'; exit 1;
fi

Try / catch

if ! argo delete "$WF" 2>err.txt; then
  grep -q 'requires either a workflow' err.txt && usage_exit
fi

Prevention

When it happens

Trigger: Running 'argo delete' with no arguments and no filter flags.

Common situations: Scripts where the workflow name variable is empty; users expecting 'argo delete' alone to prompt or delete the latest workflow; forgetting --all or --selector.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — 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/8d4e6b94558702b4. Report an issue: GitHub.