{"record":{"id":"e027ecd6a85c1d5a","repo":"argoproj/argo-workflows","slug":"requires-either-selector-or-workflow","errorCode":null,"errorMessage":"requires either selector or workflow","messagePattern":"requires either selector or workflow","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argo/commands/archive/retry.go","lineNumber":88,"sourceCode":"# Retry and watch until completion:\n\n  argo archive retry --watch my-workflow\n\t\t\n# Retry and tail logs until completion:\n\n  argo archive retry --log my-workflow\n\n# Retry a workflow by name (forced):\n\n  argo archive retry my-workflow --name\n\n# Retry a workflow by UID (forced):\n\n  argo archive retry a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 --uid\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 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, apiClient, err := client.NewAPIClient(cmd.Context())\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\tarchiveServiceClient, err := apiClient.NewArchivedWorkflowServiceClient()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tretryOpts.namespace = client.Namespace(ctx)\n\n\t\t\treturn retryArchivedWorkflows(ctx, archiveServiceClient, serviceClient, retryOpts, cliSubmitOpts, args)\n\t\t},\n\t}","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argo/commands/archive/retry.go#L70-L106","documentation":"The 'argo archive retry' command requires you to identify a target workflow either by name argument or by a label selector (--selector). Cobra's Args validator runs before RunE and rejects invocations with neither, because it cannot determine which archived workflow to retry.","triggerScenarios":"Running 'argo archive retry' with no positional workflow name and no --selector flag (with or without --uid).","commonSituations":"Users forgetting the workflow name when they meant to retry by selector, e.g. 'argo archive retry --uid' expecting a prompt; scripting where the name variable was empty.","solutions":["Pass the workflow name: argo archive retry my-wf (add --uid to treat it as a UID).","Pass a label selector: argo archive retry --selector workflows.argoproj.io/phase=Failed.","Check your script's variable for the workflow name isn't empty before invoking."],"exampleFix":"// before\nargo archive retry   # no name, no selector -> error\n// after\nargo archive retry a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 --uid","handlingStrategy":"validation","validationCode":"if [ -z \"$WF_NAME\" ] && [ -z \"$SELECTOR\" ]; then echo 'need workflow name or --selector'; exit 1; fi\nargo archive retry \"$WF_NAME\"","typeGuard":null,"tryCatchPattern":"if ! out=$(argo archive retry \"$1\" 2>&1); then\n  case \"$out\" in *'requires either selector or workflow'*) usage_exit;; esac\nfi","preventionTips":["Always pass a workflow name/UID or --selector with archive retry.","Check script variables are non-empty before invoking the CLI.","Run --help to review required arguments."],"tags":["cli","cobra","archive"],"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"}