argoproj/argo-workflows · error

unable to parse node field selector '%s': %w

Error message

unable to parse node field selector '%s': %w

What it means

`argo retry` parses --node-field-selector with fields.ParseSelector inside retryWorkflows before listing/retrying workflows; an invalid selector string is rejected client-side with this wrapped error. It occurs once up front, before any workflow lookup.

Source

Thrown at cmd/argo/commands/retry.go:112

		},
	}
	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")
	command.Flags().BoolVar(&cliSubmitOpts.Watch, "watch", false, "watch the workflow until it completes, only works when a single workflow is retried")
	command.Flags().BoolVar(&cliSubmitOpts.Log, "log", false, "log the workflow until it completes")
	command.Flags().BoolVar(&retryOpts.restartSuccessful, "restart-successful", false, "indicates to restart successful nodes matching the --node-field-selector")
	command.Flags().StringVar(&retryOpts.nodeFieldSelector, "node-field-selector", "", "selector of nodes to reset, eg: --node-field-selector inputs.parameters.myparam.value=abc")
	command.Flags().StringVarP(&retryOpts.labelSelector, "selector", "l", "", "Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)")
	command.Flags().StringVar(&retryOpts.fieldSelector, "field-selector", "", "Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.")
	return command
}

// retryWorkflows retries workflows by given retryArgs or workflow names
func retryWorkflows(ctx context.Context, serviceClient workflowpkg.WorkflowServiceClient, retryOpts retryOps, cliSubmitOpts common.CliSubmitOpts, args []string) error {
	selector, err := fields.ParseSelector(retryOpts.nodeFieldSelector)
	if err != nil {
		return fmt.Errorf("unable to parse node field selector '%s': %w", retryOpts.nodeFieldSelector, err)
	}
	var wfs wfv1.Workflows
	if retryOpts.hasSelector() {
		wfs, err = listWorkflows(ctx, serviceClient, listFlags{
			namespace: retryOpts.namespace,
			fields:    retryOpts.fieldSelector,
			labels:    retryOpts.labelSelector,
		})
		if err != nil {
			return err
		}
	}

	for _, n := range args {
		wfs = append(wfs, wfv1.Workflow{
			ObjectMeta: metav1.ObjectMeta{
				Name:      n,
				Namespace: retryOpts.namespace,

View on GitHub (pinned to 35bff19146)

Solutions

  1. Use key=value field-selector syntax, e.g. --node-field-selector displayName=approve.
  2. If you meant label selection, use the --selector flag instead of --node-field-selector.
  3. Quote the argument in the shell and avoid stray spaces around '='.

Example fix

// before
argo retry my-wf --node-field-selector 'displayName approve'
// after
argo retry my-wf --node-field-selector displayName=approve
Defensive patterns

Strategy: validation

Validate before calling

if _, err := fields.ParseSelector(retryOpts.nodeFieldSelector); err != nil {
    return fmt.Errorf("bad --node-field-selector %q", retryOpts.nodeFieldSelector)
}

Type guard

func isValidFieldSelector(s string) bool { _, err := fields.ParseSelector(s); return err == nil }

Try / catch

err := cmd.Run()
if err != nil && strings.Contains(err.Error(), "unable to parse node field selector") {
    // retry without --node-field-selector to retry entire workflow
}

Prevention

When it happens

Trigger: Running `argo retry` with a malformed --node-field-selector such as `--node-field-selector 'displayName'` (no '=value') or an empty-but-set value `--node-field-selector ''`... note empty string actually parses; real triggers are syntactically invalid selectors like '=x' or unbalanced quotes.

Common situations: Confusing label-selector syntax with field-selector syntax; shell quoting issues; copy-paste errors from docs intended for --selector (label selector) instead.

Understand the failure class

Related errors


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