argoproj/argo-workflows · error

unknown formatter: %s

Error message

unknown formatter: %s

What it means

`argo lint --output` accepts only two formatters, registered in the formatters map: `pretty` (default) and `simple`. GetFormatter looks up the requested name and returns `unknown formatter: %s` for anything else. This is a strict allowlist of lint output styles — it does not support json/yaml like some other argo commands.

Source

Thrown at cmd/argo/lint/lint.go:76

type Formatter interface {
	Format(*Result) string
	Summarize(*Results) string
}

var (
	defaultFormatter = formatterPretty{}

	formatters = map[string]Formatter{
		"pretty": formatterPretty{},
		"simple": formatterSimple{},
	}
)

func GetFormatter(fmtr string) (Formatter, error) {
	f, exists := formatters[fmtr]
	if !exists {
		return nil, fmt.Errorf("unknown formatter: %s", fmtr)
	}
	return f, nil
}

// RunLint lints the specified kinds in the specified files and prints the results to os.Stdout.
// If linting fails it will exit with status code 1.
func RunLint(ctx context.Context, client apiclient.Client, kinds []string, output string, offline bool, opts Options) error {
	fmtr, err := GetFormatter(output)
	if err != nil {
		return err
	}
	clients, err := getLintClients(ctx, client, kinds)
	if err != nil {
		return err
	}
	opts.ServiceClients = clients
	opts.Formatter = fmtr
	res, err := Lint(ctx, &opts)

View on GitHub (pinned to 35bff19146)

Solutions

  1. Use `--output pretty` (default) or `--output simple`.
  2. For machine-readable lint results, capture the `simple` format or lint via the offline API client and parse the returned Results struct.
  3. Run `argo lint --help` to see supported output values.

Example fix

// before
argo lint --output json workflow.yaml
// after
argo lint --output simple workflow.yaml
Defensive patterns

Strategy: validation

Validate before calling

func validLintFormatter(o string) bool { return o == "pretty" || o == "simple" }

Try / catch

fmtr, err := lint.GetFormatter(output)
if err != nil { return fmt.Errorf("supported: pretty, simple; got %q", output) }

Prevention

When it happens

Trigger: Running `argo lint --output json my-wf.yaml` or `-o yaml`; scripts reusing the --output value intended for `argo wf list`; calling lint.GetFormatter programmatically with a typo like "pretty-print".

Common situations: Users expecting JSON lint output for CI parsing; copy-pasted flags between argo subcommands with different output options; typos such as `--output prety`.

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


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