argoproj/argo-workflows · error

unknown output mode: %s

Error message

unknown output mode: %s

What it means

PrintWorkflows renders workflows according to PrintOpts.Output; recognized modes are name, wide, json, and yaml (with the empty string meaning the default table). Any other value hits the default branch and returns this error, so the CLI fails fast instead of printing an unexpected format.

Source

Thrown at util/printer/workflow-printer.go:49

		printCostOptimizationNudges(workflows, out)
	case "name":
		for _, wf := range workflows {
			_, _ = fmt.Fprintln(out, wf.Name)
		}
	case "json":
		output, err := json.MarshalIndent(workflows, "", "  ")
		if err != nil {
			return err
		}
		_, _ = fmt.Fprintln(out, string(output))
	case "yaml":
		output, err := yaml.Marshal(workflows)
		if err != nil {
			return err
		}
		_, _ = fmt.Fprintln(out, string(output))
	default:
		return fmt.Errorf("unknown output mode: %s", opts.Output)
	}
	return nil
}

type PrintOpts struct {
	NoHeaders bool
	Namespace bool
	Output    string
	UID       bool
}

func printTable(wfList []wfv1.Workflow, out io.Writer, opts PrintOpts) {
	w := tabwriter.NewWriter(out, 0, 0, 3, ' ', 0)
	if !opts.NoHeaders {
		if opts.Namespace {
			_, _ = fmt.Fprint(w, "NAMESPACE\t")
		}
		_, _ = fmt.Fprint(w, "NAME\tSTATUS\tAGE\tDURATION\tPRIORITY\tMESSAGE")

View on GitHub (pinned to 35bff19146)

Solutions

  1. Use a supported value: (empty for default table), name, wide, json, or yaml.
  2. Replace -o yml with -o yaml.
  3. For CSV or custom formats, use -o json and transform with jq.
  4. Validate the flag in scripts: case/whitelist before invoking the CLI.

Example fix

# before
argo list -o yml > out.yaml
# after
argo list -o yaml > out.yaml
Defensive patterns

Strategy: validation

Validate before calling

var validOutputs = map[string]bool{"": true, "name": true, "wide": true, "json": true, "yaml": true}
func outputValid(o string) bool { return validOutputs[o] }

Try / catch

if err := printer.PrintWorkflows(ctx, wfs, out, opts); err != nil {
    if strings.HasPrefix(err.Error(), "unknown output mode") {
        return fmt.Errorf("-o must be one of name|wide|json|yaml: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Running `argo list -o <bad>` (e.g. `-o table`, `-o csv`, `-o yaml` with a typo like `-o yml`) or programmatically passing PrintOpts{Output: "yaml "} with stray characters.

Common situations: Muscle memory from kubectl's -o flag values (table/columns/custom-columns) that Argo does not implement; typos like yml vs yaml; scripts interpolating an empty or malformed output variable.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/1f558ea2e175239e. Report an issue: GitHub.