{"record":{"id":"584d6419df6c4710","repo":"argoproj/argo-workflows","slug":"requires-either-node-field-selector-or-workflow-584d64","errorCode":null,"errorMessage":"requires either node field selector or workflow","messagePattern":"requires either node field selector or workflow","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argo/commands/retry.go","lineNumber":80,"sourceCode":"\n# Retry and watch until completion:\n\n  argo retry --watch my-wf.yaml\n\n# Retry and tail logs until completion:\n\n  argo retry --log my-wf.yaml\n\n# Retry the latest workflow:\n\n  argo retry @latest\n\n# Restart node with id 5 on successful workflow, using node-field-selector\n  argo retry my-wf --restart-successful --node-field-selector id=5\n`,\n\t\tArgs: func(cmd *cobra.Command, args []string) error {\n\t\t\tif len(args) == 0 && !retryOpts.hasSelector() {\n\t\t\t\treturn errors.New(\"requires either node field selector or workflow\")\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tctx := cmd.Context()\n\t\t\tctx, apiClient, err := client.NewAPIClient(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tserviceClient := apiClient.NewWorkflowServiceClient(ctx)\n\t\t\tretryOpts.namespace = client.Namespace(ctx)\n\n\t\t\treturn retryWorkflows(ctx, serviceClient, retryOpts, cliSubmitOpts, args)\n\t\t},\n\t}\n\tcommand.Flags().StringArrayVarP(&cliSubmitOpts.Parameters, \"parameter\", \"p\", []string{}, \"input parameter to override on the original workflow spec\")\n\tcommand.Flags().VarP(&cliSubmitOpts.Output, \"output\", \"o\", \"Output format. \"+cliSubmitOpts.Output.Usage())\n\tcommand.Flags().BoolVarP(&cliSubmitOpts.Wait, \"wait\", \"w\", false, \"wait for the workflow to complete, only works when a single workflow is retried\")","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argo/commands/retry.go#L62-L98","documentation":"`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.","triggerScenarios":"Running `argo retry` with no workflow argument and no selector flags (retryOpts.hasSelector() false) — e.g. `argo retry --restart-successful` alone.","commonSituations":"Scripting with an empty workflow-name variable; assuming retry re-operates on the last workflow; truncating a longer command when editing shell history.","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"],"exampleFix":"// before\nargo retry --restart-successful\n// after\nargo retry my-wf --restart-successful --node-field-selector id=5","handlingStrategy":"validation","validationCode":"if [ -z \"$WF_NAME\" ] && [ -z \"$NODE_FIELD_SELECTOR\" ]; then\n  echo \"argo retry: requires either node field selector or workflow\" >&2; exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","argument-validation","argo-cli","retry"],"backgroundTag":"missing-required-argument","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}