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 stop` parses --node-field-selector with fields.ParseSelector inside stopWorkflows before listing/stopping workflows; an invalid selector is rejected client-side with this wrapped error, before any API call.
Source
Thrown at cmd/argo/commands/stop.go:87
serviceClient := apiClient.NewWorkflowServiceClient(ctx)
stopArgs.namespace = client.Namespace(ctx)
return stopWorkflows(ctx, serviceClient, stopArgs, args)
},
}
command.Flags().StringVar(&stopArgs.message, "message", "", "Message to add to previously running nodes")
command.Flags().StringVar(&stopArgs.nodeFieldSelector, "node-field-selector", "", "selector of node to stop, eg: --node-field-selector inputs.parameters.myparam.value=abc")
command.Flags().StringVarP(&stopArgs.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(&stopArgs.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.")
command.Flags().BoolVar(&stopArgs.dryRun, "dry-run", false, "If true, only print the workflows that would be stopped, without stopping them.")
return command
}
// stopWorkflows stops workflows by given stopArgs or workflow names
func stopWorkflows(ctx context.Context, serviceClient workflowpkg.WorkflowServiceClient, stopArgs stopOps, args []string) error {
selector, err := fields.ParseSelector(stopArgs.nodeFieldSelector)
if err != nil {
return fmt.Errorf("unable to parse node field selector '%s': %w", stopArgs.nodeFieldSelector, err)
}
var wfs wfv1.Workflows
if stopArgs.hasSelector() {
wfs, err = listWorkflows(ctx, serviceClient, listFlags{
namespace: stopArgs.namespace,
fields: stopArgs.fieldSelector,
labels: stopArgs.labelSelector,
})
if err != nil {
return err
}
}
for _, n := range args {
wfs = append(wfs, wfv1.Workflow{
ObjectMeta: metav1.ObjectMeta{
Name: n,
Namespace: stopArgs.namespace,View on GitHub (pinned to 35bff19146)
Solutions
- Provide key=value form, e.g. --node-field-selector displayName=approve.
- Drop the flag to stop the entire workflow(s).
- Quote the selector to protect '=' in the shell.
Example fix
// before argo stop my-wf --node-field-selector 'displayName' // after argo stop my-wf --node-field-selector displayName=approve
Defensive patterns
Strategy: validation
Validate before calling
if _, err := fields.ParseSelector(stopArgs.nodeFieldSelector); err != nil {
return fmt.Errorf("bad --node-field-selector %q", stopArgs.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") {
// fall back: stop entire workflow without selector
} Prevention
- Always key=value for --node-field-selector.
- Quote selectors in shell.
- Do not mix label-selector operators into field selectors.
When it happens
Trigger: Running `argo stop` with a malformed --node-field-selector, e.g. `--node-field-selector 'displayName'` (missing '=value') or invalid operators unsupported by field selectors.
Common situations: Using label-selector operators (in, notin, exists) in a field selector; quoting stripped the '='; typo producing a bare key with no value.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- unable to parse node field selector '%s': %w
- unable to parse node field selector '%s': %w
- unable to parse node field selector '%s': %w
- unable to parse node field selector '%s': %w
- scheduled-time contains invalid time.RFC3339 format. (e.g.:
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/350978c2f496f882.
Report an issue: GitHub.