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
The `argo node set` command requires --node-field-selector to identify which node to modify; it is parsed with k8s.io/apimachinery fields.ParseSelector. If the selector string is not a valid comma-separated key=value (or key==value / key!=value) field selector, this error wraps the underlying parse error.
Source
Thrown at cmd/argo/commands/node.go:74
}
res, err := json.Marshal(outputParams)
if err != nil {
return fmt.Errorf("unable to parse output parameter set request: %w", err)
}
outputParameters = string(res)
}
ctx := cmd.Context()
ctx, apiClient, err := client.NewAPIClient(ctx)
if err != nil {
return err
}
serviceClient := apiClient.NewWorkflowServiceClient(ctx)
namespace := client.Namespace(ctx)
selector, err := fields.ParseSelector(setArgs.nodeFieldSelector)
if err != nil {
return fmt.Errorf("unable to parse node field selector '%s': %w", setArgs.nodeFieldSelector, err)
}
_, err = serviceClient.SetWorkflow(ctx, &workflowpkg.WorkflowSetRequest{
Name: args[1],
Namespace: namespace,
NodeFieldSelector: selector.String(),
Message: setArgs.message,
Phase: setArgs.phase,
OutputParameters: outputParameters,
})
if err != nil {
return err
}
fmt.Printf("workflow values set\n")
return nil
},
}
command.Flags().StringVar(&setArgs.nodeFieldSelector, "node-field-selector", "", "Selector of node to set, eg: --node-field-selector inputs.parameters.myparam.value=abc")View on GitHub (pinned to 35bff19146)
Solutions
- Use key=value form, e.g. --node-field-selector displayName=approve or inputs.parameters.myparam.value=abc.
- Escape special characters and quote the whole selector in the shell.
- Omit spaces around '=' (ParseSelector is strict about format).
Example fix
// before argo node set my-wf --node-field-selector displayName --message "hi" // after argo node set my-wf --node-field-selector displayName=approve --message "hi"
Defensive patterns
Strategy: validation
Validate before calling
sel := "displayName=approve"
if _, err := fields.ParseSelector(sel); err != nil {
return fmt.Errorf("invalid --node-field-selector %q: %w", sel, err)
} 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") {
log.Fatalf("fix --node-field-selector syntax (key=value): %v", err)
} Prevention
- Always use key=value form for --node-field-selector.
- Do not use label-selector operators (in/exists) here.
- Quote selectors in shell scripts to preserve '='.
When it happens
Trigger: Running `argo node set` with a malformed --node-field-selector such as `displayName` (no '='), `=approve` (empty key), or invalid escaping, e.g. `--node-field-selector 'displayName'`.
Common situations: Forgetting the =value part; quoting mistakes in shell that drop '='; using unsupported syntax like label-selector operators (in/exists) which fields.ParseSelector rejects.
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/ce4bef5f2986951e.
Report an issue: GitHub.