argoproj/argo-workflows · error
unknown output mode: %s
Error message
unknown output mode: %s
What it means
`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.
Source
Thrown at cmd/argo/commands/template/list.go:66
wftmplList, err := serviceClient.ListWorkflowTemplates(ctx, &workflowtemplatepkg.WorkflowTemplateListRequest{
Namespace: namespace,
ListOptions: &metav1.ListOptions{
LabelSelector: labelSelector.String(),
},
})
if err != nil {
return err
}
switch listArgs.output.String() {
case "", "wide":
printTable(wftmplList.Items, &listArgs)
case "name":
for _, wftmp := range wftmplList.Items {
fmt.Println(wftmp.Name)
}
default:
return fmt.Errorf("unknown output mode: %s", listArgs.output)
}
return nil
},
}
command.Flags().BoolVarP(&listArgs.allNamespaces, "all-namespaces", "A", false, "Show workflows from all namespaces")
command.Flags().VarP(&listArgs.output, "output", "o", "Output format. "+listArgs.output.Usage())
command.Flags().StringVarP(&listArgs.labels, "selector", "l", "", "Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)")
return command
}
func printTable(wfList []wfv1.WorkflowTemplate, listArgs *listFlags) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0)
if listArgs.allNamespaces {
_, _ = fmt.Fprint(w, "NAMESPACE\t")
}
_, _ = fmt.Fprint(w, "NAME")
_, _ = fmt.Fprint(w, "\n")
for _, wf := range wfList {View on GitHub (pinned to 35bff19146)
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.
Example fix
// before argo template list -o json // after argo template list -o name # or: kubectl get workflowtemplates -o json
Defensive patterns
Strategy: validation
Validate before calling
allowed := map[string]bool{"": true, "wide": true, "name": true}
if !allowed[output] { return fmt.Errorf("output must be wide or name, got %q", output) } Type guard
func validTemplateListOutput(o string) bool { return o == "" || o == "wide" || o == "name" } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.
Related errors
- unknown formatter: %s
- unknown kind: %s
- unknown output mode: %s
- requires either selector or workflow
- Multiple archived workflows found with name '%s': %s (Crea
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/a4c5a2f522194a1d.
Report an issue: GitHub.