argoproj/argo-workflows · error
requires either node field selector or workflow
Error message
requires either node field selector or workflow
What it means
`argo retry` requires a workflow name (positional args) or a selector via retryOpts.hasSelector() (--node-field-selector or equivalent) to know what to retry. The cobra Args validator at cmd/argo/commands/retry.go:80 returns this error when neither is given, since retrying 'nothing' is undefined.
Source
Thrown at cmd/argo/commands/retry.go:80
# Retry and watch until completion:
argo retry --watch my-wf.yaml
# Retry and tail logs until completion:
argo retry --log my-wf.yaml
# Retry the latest workflow:
argo retry @latest
# Restart node with id 5 on successful workflow, using node-field-selector
argo retry my-wf --restart-successful --node-field-selector id=5
`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 && !retryOpts.hasSelector() {
return errors.New("requires either node field selector or workflow")
}
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)
retryOpts.namespace = client.Namespace(ctx)
return retryWorkflows(ctx, serviceClient, retryOpts, cliSubmitOpts, args)
},
}
command.Flags().StringArrayVarP(&cliSubmitOpts.Parameters, "parameter", "p", []string{}, "input parameter to override on the original workflow spec")
command.Flags().VarP(&cliSubmitOpts.Output, "output", "o", "Output format. "+cliSubmitOpts.Output.Usage())
command.Flags().BoolVarP(&cliSubmitOpts.Wait, "wait", "w", false, "wait for the workflow to complete, only works when a single workflow is retried")View on GitHub (pinned to 35bff19146)
Solutions
- Add the workflow name: `argo retry my-wf`
- Or add a selector: `argo retry --node-field-selector id=5` (optionally with --restart-successful)
- Check scripts for empty/unset variables passed as the workflow name
Example fix
// before argo retry --restart-successful // after argo retry my-wf --restart-successful --node-field-selector id=5
Defensive patterns
Strategy: validation
Validate before calling
if [ -z "$WF_NAME" ] && [ -z "$NODE_FIELD_SELECTOR" ]; then echo "argo retry: requires either node field selector or workflow" >&2; exit 2 fi
Prevention
- There is no 'retry last' — always name the workflow
- Verify variables expanding to the workflow name are non-empty
- Add shellset -u so unset workflow variables fail fast
When it happens
Trigger: Running `argo retry` with no workflow argument and no selector flags (retryOpts.hasSelector() false) — e.g. `argo retry --restart-successful` alone.
Common situations: Scripting with an empty workflow-name variable; assuming retry re-operates on the last workflow; truncating a longer command when editing shell history.
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
- requires either node field selector or workflow
- requires either selector or workflow
- --since-time and --since cannot be used together
- cannot combine --from with file arguments
- cannot watch more than one workflow
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/584d6419df6c4710.
Report an issue: GitHub.