argoproj/argo-workflows · error
requires either selector or workflow
Error message
requires either selector or workflow
What it means
The 'argo archive retry' command requires you to identify a target workflow either by name argument or by a label selector (--selector). Cobra's Args validator runs before RunE and rejects invocations with neither, because it cannot determine which archived workflow to retry.
Source
Thrown at cmd/argo/commands/archive/retry.go:88
# Retry and watch until completion:
argo archive retry --watch my-workflow
# Retry and tail logs until completion:
argo archive retry --log my-workflow
# Retry a workflow by name (forced):
argo archive retry my-workflow --name
# Retry a workflow by UID (forced):
argo archive retry a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 --uid
`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 && !retryOpts.hasSelector() {
return errors.New("requires either selector or workflow")
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
ctx, apiClient, err := client.NewAPIClient(cmd.Context())
if err != nil {
return err
}
serviceClient := apiClient.NewWorkflowServiceClient(ctx)
archiveServiceClient, err := apiClient.NewArchivedWorkflowServiceClient()
if err != nil {
return err
}
retryOpts.namespace = client.Namespace(ctx)
return retryArchivedWorkflows(ctx, archiveServiceClient, serviceClient, retryOpts, cliSubmitOpts, args)
},
}View on GitHub (pinned to 35bff19146)
Solutions
- Pass the workflow name: argo archive retry my-wf (add --uid to treat it as a UID).
- Pass a label selector: argo archive retry --selector workflows.argoproj.io/phase=Failed.
- Check your script's variable for the workflow name isn't empty before invoking.
Example fix
// before argo archive retry # no name, no selector -> error // after argo archive retry a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 --uid
Defensive patterns
Strategy: validation
Validate before calling
if [ -z "$WF_NAME" ] && [ -z "$SELECTOR" ]; then echo 'need workflow name or --selector'; exit 1; fi argo archive retry "$WF_NAME"
Try / catch
if ! out=$(argo archive retry "$1" 2>&1); then case "$out" in *'requires either selector or workflow'*) usage_exit;; esac fi
Prevention
- Always pass a workflow name/UID or --selector with archive retry.
- Check script variables are non-empty before invoking the CLI.
- Run --help to review required arguments.
When it happens
Trigger: Running 'argo archive retry' with no positional workflow name and no --selector flag (with or without --uid).
Common situations: Users forgetting the workflow name when they meant to retry by selector, e.g. 'argo archive retry --uid' expecting a prompt; scripting where the name variable was empty.
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
- Multiple archived workflows found with name '%s': %s (Crea
- requires either a workflow or other argument
- resolve UID: %w
- resolve UID: %w
- resolve UID: %w
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/e027ecd6a85c1d5a.
Report an issue: GitHub.