{"record":{"id":"a4c5a2f522194a1d","repo":"argoproj/argo-workflows","slug":"unknown-output-mode-s-a4c5a2","errorCode":null,"errorMessage":"unknown output mode: %s","messagePattern":"unknown output mode: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/argo/commands/template/list.go","lineNumber":66,"sourceCode":"\n\t\t\twftmplList, err := serviceClient.ListWorkflowTemplates(ctx, &workflowtemplatepkg.WorkflowTemplateListRequest{\n\t\t\t\tNamespace: namespace,\n\t\t\t\tListOptions: &metav1.ListOptions{\n\t\t\t\t\tLabelSelector: labelSelector.String(),\n\t\t\t\t},\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tswitch listArgs.output.String() {\n\t\t\tcase \"\", \"wide\":\n\t\t\t\tprintTable(wftmplList.Items, &listArgs)\n\t\t\tcase \"name\":\n\t\t\t\tfor _, wftmp := range wftmplList.Items {\n\t\t\t\t\tfmt.Println(wftmp.Name)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"unknown output mode: %s\", listArgs.output)\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcommand.Flags().BoolVarP(&listArgs.allNamespaces, \"all-namespaces\", \"A\", false, \"Show workflows from all namespaces\")\n\tcommand.Flags().VarP(&listArgs.output, \"output\", \"o\", \"Output format. \"+listArgs.output.Usage())\n\tcommand.Flags().StringVarP(&listArgs.labels, \"selector\", \"l\", \"\", \"Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)\")\n\treturn command\n}\n\nfunc printTable(wfList []wfv1.WorkflowTemplate, listArgs *listFlags) {\n\tw := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0)\n\tif listArgs.allNamespaces {\n\t\t_, _ = fmt.Fprint(w, \"NAMESPACE\\t\")\n\t}\n\t_, _ = fmt.Fprint(w, \"NAME\")\n\t_, _ = fmt.Fprint(w, \"\\n\")\n\tfor _, wf := range wfList {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/cmd/argo/commands/template/list.go#L48-L84","documentation":"`argo template list` supports only two output formats: the default table (`wide`) and `name`. The command's switch statement falls through to a default case that returns `unknown output mode: %s` when `--output` is set to anything else. Normally the `EnumFlagValue` flag definition rejects bad values at parse time, so this error is a defensive fallback for programmatically-set or manipulated flag values.","triggerScenarios":"Running `argo template list -o json` (or yaml, etc.); constructing the command in tests or code and setting listArgs.output to a value outside {\"\", \"wide\", \"name\"}; older CLI versions or scripts copied from `argo wf list` examples (which support more formats) being reused for templates.","commonSituations":"Users scripting `argo template list -o json` expecting parity with `argo workflow list -o json`; shell aliases/argument passing mixing up workflow and template subcommands; tests calling the RunE function directly with arbitrary output values.","solutions":["Use a supported output format: omit --output or use -o wide (table) or -o name (one name per line).","For machine-readable output use `argo template list -o name` and post-process, or fetch via the API/`kubectl get workflowtemplates -o json`.","Check `argo template list --help` for the exact allowed values of --output."],"exampleFix":"// before\nargo template list -o json\n// after\nargo template list -o name   # or: kubectl get workflowtemplates -o json","handlingStrategy":"validation","validationCode":"allowed := map[string]bool{\"\": true, \"wide\": true, \"name\": true}\nif !allowed[output] { return fmt.Errorf(\"output must be wide or name, got %q\", output) }","typeGuard":"func validTemplateListOutput(o string) bool { return o == \"\" || o == \"wide\" || o == \"name\" }","tryCatchPattern":null,"preventionTips":["Never pass -o json/yaml to argo template list; use -o name or kubectl for structured output","Check --help for allowed output values per argo subcommand","In scripts, validate the output flag against the subcommand's EnumFlagValue before invoking"],"tags":["cli","flag-validation","output-format"],"backgroundTag":"invalid-flag-value","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}